Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
社å ã§iOSã¢ããªéçºåå¿è ã«ã StoryboardãViewControlleråä½ã§åããå ´åã®ç»é¢é·ç§»ãå¤æ¸¡ãæ¹æ³ã®èª¬ææãµã³ãã«ã¨ãã¦æ®ãã¦ãã ç°å¢ Xcode: 11.3.1 Swift5 ã»é·ç§»å ã®UIViewControllerãStoryBoardãä½æãã UIViewControllerãä½æ ããã¸ã§ã¯ãããã±ã¼ã¿ãå³ã¯ãªãã¯ããNew Fileãé¸æ Cocoa Touch Classãé¸æ Class: NextViewControllerã Subclass of: UIViewControllerã Also Create XIB File: ãã§ãã¯å¤ãã Languageï¼Swift Nextãé¸æ ãã®ã¾ã¾Createã§OK StoryBoardãä½æ ããã¸ã§ã¯ãããã±ã¼ã¿ãå³ã¯ãªãã¯ããNew Fileãé¸æ Storyboardãé¸æ Next
Kotlin / Swift ã§ã® Unicode ã®æ±ãã¾ã¨ã (è¦ãç®ä¸ã®æåæ°ã«ã¦ã³ã, UTF-8, UTF-16, BOM, æ£è¦å, ç°ä½åã»ã¬ã¯ã¿)AndroidiOSKotlinUnicodeSwift Kotlin 㨠Swift ã§ã®è¦ãç®ä¸ã®æåæ°ã«ã¦ã³ãå®è£ ãä¸å¿ã«ãUnicode ã«ã¤ãã¦ç¥ã£ã¦ããã¹ãç¥èãã¾ã¨ãã¾ãã ã¾ããã¢ãã¤ã«ã¢ããªã§å ¥åæåæ°ã®ã«ã¦ã³ããå ¥åæåæ°ã®ä¸éãã©ã®ããã«æ±ããã¯ä»¥ä¸ã®å¥ã®è¨äºã«ã¾ã¨ãã¾ããã æåæ°ã«ã¦ã³ã ã¾ãã¯ãæåæ°ã«ã¦ã³ããé£ããä¾ã¨ãã¦çµµæåã¨ç°ä½åã»ã¬ã¯ã¿è¡¨ç¾ã®ä¾ãæãã¾ãã詳ãã説æã¯ãã®è¨äºã®å¾åã確èªãã¦ãã ããã çµµæå ð§â𦰠ã®æåæ°ã«ã¤ãã¦ç¢ºèªãã¾ããð§â𦰠ã¯ä»¥ä¸ã® Unicode ã§æ§æããã¦ãã¾ãã æå Code point UTF-8 è¡¨ç¾ UTF-16 è¡¨ç¾ Descriptio
ã¯ããã« æ¬è¨äºã¯ Swift/Kotlinæå¥½ä¼ Advent Calendar 2021 ã®17æ¥ç®ã®è¨äºã§ãã 空ãã¦ããã®ã§åãã¾ããã ãä¾åæ§é転ã®ååãã¨ãä¾åæ§ã®æ³¨å ¥ããå®å ¨ã«ç解ããã®ã§èª¬æãã¾ãã ãä¾åæ§é転ã®ååï¼DIPï¼ãã¨ã¯ï¼ è±èªã§ãDependency Inversion Principleãã¨ããããDIPãã¨ç¥ããã¨ãå¤ãã§ãã SOLID ã®5ååã®1ã¤ã§ãã å¾æ¥ã®ã¬ã¤ã¤ã¼ãã¿ã¼ã³ ä¾ãã° MVP ã¢ã¼ããã¯ãã£ã®Viewã¨Presenterã§èãã¦ã¿ã¾ãã Viewã¨Presenterã®éã«ã¯ä»¥ä¸ã®ç¹å¾´ãããã¾ãã Viewï¼UIï¼ã¯Presenterã®ãã¨ãç¥ãã¹ãã§ã¯ãªã Presenterã¯Viewããã¡ãã»ã¼ã¸ãåãåããããã«åºã¥ãã¦å¦çãè¡ããViewã«åæ ãã ããã¯ãViewã¯Presenterã«ä¾åãããPresenterã¯Vie
ã¿ã¹ã¯ãåªå é ä½ä»ãã§ä½æããã¿ã¹ã¯ãå®è¡ããã¿ã¹ã¯ããã£ã³ã»ã«ãã¾ãã ã¦ã¼ã¶ã¼ããéä¸ã¢ã¼ããããªã³ã«ãããã©ãããææ¡ãã ä½ç½®æ å ±ãã¿ã³ (SwiftUI) SwiftUIãå©ç¨ãã¦ãªã¢ã¼ãç»åãèªã¿è¾¼ã (SwiftUI) Listãªã¹ãã®æ¤ç´¢æ©è½ (SwiftUI) ãªã¹ãã»ãã¬ã¼ã¿ãé ã (SwiftUI) ãªã¹ãã«Pull to Refreshï¼å¼ã£å¼µã£ã¦æ´æ°ï¼æ©è½ã追å (SwiftUI) ããã¹ããã£ã¼ã«ãã®ãã©ã¼ã«ã¹ãå¤ã (SwiftUI) ãªã¹ãã»ã«ã«ã¹ã¯ã¤ãã¢ã¯ã·ã§ã³ã追å ãã (SwiftUI) ããã¹ããã¥ã¼ã§ãã¼ã¯ãã¦ã³ã使ç¨ãã (SwiftUI) ç»é¢ã表示ããããã¿ã¹ã¯ãå®è¡ãã¾ã (SwiftUI) ã¿ããã¥ã¼ã«ããã¸ï¼æªèªã¡ãã»ã¼ã¸ã«ã¦ã³ã¿ã¼ï¼ã追å ãã®è¨äºã¯ developer.apple.com ä¸ã§å ¬éããã¦ããææ¸ã«åºã¥ãã¦æ¸ããã¾ãã
ã¯ãã㫠以ä¸ã®ãã£ãã·ã¥æ å ±ãåé¤ããæ¹æ³ãã¾ã¨ãã¾ããããã¼ãã·ã¼ãçã«ã³ãããã¦ä½¿ã£ã¦é ããã°ã¨æãã¾ãã æ§ã ãªãã£ãã·ã¥ã®åé¤æ¹æ³ãç¥ã£ã¦ãããã¨ã§ããªã³ã¯ããã¾ãã§ããªããç»åãªã©ã®ãªã½ã¼ã¹ãã¡ã¤ã«ãæ´æ°ãããªããXcodeã®ã³ã¼ãè£å®ãã§ãªããã¨ã©ã¼ã解æ¶ã§ããªãããªã©åé¡ãèµ·ãã£ãéã®æå©ãã«ãªãã¾ãã Xcode llvm/clang Homebrew SwiftLint CocoaPods Carthage Fastlane Note: ãã£ãã·ã¥ãã¡ã¤ã«ã®åé¤ã¯èªå·±è²¬ä»»ã§ãé¡ããããã¾ãã Xcodeã®ãã£ãã·ã¥åé¤ Xcode.appã®ãã£ãã·ã¥åé¤
ã¯ããã« ããã«ã¡ã¯ï¼ iOSã¨ã³ã¸ãã¢ã®ãã¾ã㤠ã§ãâºï¸ Oshidoriã¨ããã¢ããªãå人ã§éçºãããªãªã¼ã¹ãã¦ãã¾ãï¼ï¼ï¼Oshidoriã¨ããã¢ããªãå人ã§éçºãããªãªã¼ã¹ãã¦ãã¾ãï¼ï¼ï¼ éåæå¦çãæ¸ãæ¹æ³ã£ã¦ããã¤ããããã ãªãã¨æã£ã¦ã¾ã¨ãã¦ã¿ãããªã£ãã®ã§æ¸ãã¾ãã! å®åã ã£ãããå人ã¢ããªã§ä½¿ã£ãéåæå¦çã®ãã¿ã¼ã³ãæ¸ãããã¨æãã¾ãã è¤æ°éä¿¡ã®æã®å¦çãæ¸ãã¾ãã Promise Kit ãæè½ããã¦æåããã®ã§ Promise Kit è´å±ã«ãªã£ã¦ã¾ãããäºæ¿ãã ããã ã¯ãã¼ã¸ã£ã使ã£ã¦éåæå¦çãæ¸ã // ãããã¯ãã¼ã¸ã£ //////////////////// func fetchUser(id: Int, completion: @escaping (User?,Error?)->()) { // ããã§éä¿¡ userInfoRep.fetch(
ããã¯ãªã« Swift ã§ã¯ã¯ã©ã¹ãã¼ã¹ã®éçºããããããã³ã«ãã¼ã¹ã®éçºã«ãã¦ããã¾ããããã¨ããææ¡ã§ãã ãããµãã¯ã©ã¹ã¨ã¯ãå¥ãã§ãã ç°å¢ Swift 2.2 Protocol ã¨ã¯ Objective-C ã§ã¯ @interface ã¨æ¸ãã¦ãããã®ã¨ããã°ã¤ã¡ã¼ã¸ãããããã¨æãã¾ããã Swift ã§ã¯ããã®æ©è½ãããªãæ¡å¼µããã¦ãã¾ãã ç¹ã« Swift 2.0 以éã§ã¯ Protocol Extension ã®æ©è½ã追å ããã Protocol ãããã©ã«ãå®è£ ããã¦ãããã«ãªã£ãã®ã§ããã«ä¾¿å©ã«ãªãã¾ããã 使ç¨ä¾ ã¨ãããããç¬ç«ããããããã£ã¼ãã£ã¼é³´ããã¦ã¿ã¾ãããã protocol Animal { var name: String { get } var age: Int { set get } func bark() -> String }
ã¿ã¤ãã«éãã§ãã ããããæå¤ã¨ä¸ã¤ã«ã¾ã¨ã¾ã£ã¦ãããã®ããªãã£ãã®ã§æ¸ãã¦ã¿ã¾ãã ã¤ãã§ã«labelã§è¤æ°è¡è¨è¿°ãã¦ãã¾ãã let label = UILabel() // widthã¯é©å½ã«è¨å®ãç»é¢å¹ ãåå¾ãlabelãä¸å¤®ã«é ç½®ãããããã«ããã let screenwidth = Float(UIScreen.main.bounds.size.width) let width = 300 let widthGap = (screenwidth - Float(width)) / 2 label.frame = CGRect(x: Int(widthGap), y: 100, width: Int(width), height: 60) // textAlignmentã§æåãä¸å¤®æãã«ã label.textAlignment = NSTextAlignment.cente
ãã®è¨äºã¯ãNIFTY Advent Calendar 2017ã®2æ¥ç®ã®è¨äºã§ã 1æ¥ç®ã¯winterwind26ããã®ã[PHP] LINE Messaging API ã使ã£ããã£ãããããããã¹ããã¦ã¿ããã§ããã ãããã£ã§ã¢ãã¤ã«ã¢ããªã¨ã³ã¸ãã¢(iOSã¡ã¤ã³)ããã¦ãã¾ããhicka04ã§ãã â»å®ã¯ãã®è¨äºãQiitaåæ稿ãªã®ã§ã温ããç®ã§è¦å®ã£ã¦ããã ããã¨å¹¸ãã§ãã ä»åã¯ãèªåãæ å½ãã¦ããiOSã¢ããªã®æ¹åããããã¦åå¼·ãããã¨ãå ±æãããã¨æãã¾ãã å段 MVPã¨ã¯ Model - View - Presenterãããªãã¢ã¼ããã¯ã㣠MVVMãClean Architectureãªã©ããã¾ãã¾ãªã¢ã¼ããã¯ãã£ã®ãã¡ã®ä¸ã¤ ãªãMVCããè±å´ãããã®ã? ViewControllerã®è¥å¤§å ããããFatViewController / MassiveVi
ä»åãããViewControllerããå¥ã®ViewControllerã«å¦çãä¼æ¬ããããã®ãããã 調ã¹ãã¨ãããNotificationCenterã使ãã°å®ç¾ã§ããã¨ç¥ãå®è£ ãã¾ããã ä»åã¯ãã®å®è£ æ¹æ³ã«ã¤ãã¦èª¬æãã¦ã¿ããã¨æãã¾ãã NotificationCenterã£ã¦ï¼ï¼ NotificationCenterã¯ãç°ãªãViewControlleréã®ã¤ãã³ãéç¥ãå®ç¾ã§ãããã®ã§ã çºä¿¡å´ã¨åä¿¡å´ãåå¨ãã¾ãã ããããããã®éç¥ãæ¥ãããã®å¦çãããï¼ ãã®å¦çãå®è¡ããããã®ViewControllerã«å¦çããé¡ãããï¼ ã¿ãããªãã¨ãå¯è½ã«ãªãã¾ãã
注æ: ãã®è¨äºã¯v0.39.0以éã«å¯¾å¿ãã¦ãã¾ããã ååãªãªã¼ã¹ãã0.39.0ã¾ã§ãEffectåã¯Combine.Publisherãããã³ã«ã«æºæ ãã¦ãã¾ãããã0.39.0以éã¯Swift Concurrencyã«ããReducerã®ä»çµã¿ãå¤æ´ããã¦ããã®ã§ããã辺ããèæ ®é¡ãã¾ãã Swiftãç¨ããiOS/macOS/tvOS/watchOSã¢ããªéçºç¨ã« The Composable Architecture(TCA)ã¨ããã®ããããããããã£ã¡ãè¯ãããï¼ã¨æã£ãã®ã§ãããæ¸ãã¦ããã¾ãããã¬ã¼ã ã¯ã¼ã¯çã«æä¾ããã¦ãã¾ãããç¹ã«SwiftUIã使ã£ã¦ã©ãããæ§æã§ã¢ããªãä½ãããã¨èãã¦ãã人ãã³ã¼ããèªãã ãã§ãã¨ã¦ãããææã«ãªãã¨æãã¾ãã The Composable Archtectureãææ¡ãã¦ããã®ã¯ãé¢æ°åããã°ã©ãã³ã°ã¨Swiftã«ã¤ãã¦ã®åç»
ã¯ããã« ä»åãQiitaåæ稿ã§ã æ®æ®µã¯ï¼Swiftã»Pythonã»Goãããã触ã£ã¦ããå·çè ã§ã çæããç®ç·ã§ãé¡ããã¾ã å·çãããã£ãã MVVMãFluxãå¦ã¶åã«ï¼MVCã¨MVPã復ç¿ãã iOSã¢ããªè¨è¨ãã¿ã¼ã³ãèªãã çµæï¼æãæ¹ãããã¨ã«ãªã£ããã åå¿é²ã¨ãã¦æ®ãããã£ããã èªè ã«æ±ããã㨠iOSã¨ã³ã¸ãã¢ã§ããå¿ è¦ã¯ããã¾ãã ãã ãï¼Appleã«ãããââã¨ãã表ç¾ã¯ãã¾ã ã¢ã¼ããã¯ãã£ã£ã¦ï¼ã¨ãã¢ã¼ããã¯ãã£ï¼ï¼ï¼ãªãã»ã©ãããããã ã£ã¦æ¹ï¼ä¸ç·ã«åå¼·ãã¦ããã¾ããã!!ï¼ iOSã¢ããªè¨è¨ãã¿ã¼ã³ãæå ã«ç½®ããªããï¼èªãã§ã»ããã§ãï¼ MVC ãã¾ãå¤ãã¯è§¦ãã¾ãããï¼MVPãè¿°ã¹ãããã«ã¯å¿ è¦ä¸å¯æ¬ ãªç¥èã§ããããæ¸ãã¾ã Appleã«ãããMVCã¯å°ãç¹æ®ã§ãï¼ååMVCã¨ä½ãéããã«ã¤ãã¦ã¯ï¼è¡¨ã示ããä¸ã§èª¬æãã¾ãï¼ ååMVC ã¬ã¤ã¤ã¼
ã¯ããã« ãã¾ããã ãã© iOS ã®ãã¡ã¤ã«æä½ã«ã¤ãã¦ã¾ã¨ãã¾ãããã¹ãã¢ã«å ¬éããªãæ¥åç¨ã¢ããªã¨ãã¤ãã£ã¦ãã¨ããã¨ã¬ã¤ãã©ã¤ã³ã¨ãããããããã ãã¡ã¤ã«ä¿åå File System Programming Guide ãã¿ãã¨ãã¡ã¤ã«ã®ä¿åå ã¯ä¸è¨ã®ããã«ãªã£ã¦ããæ§åãç®çã«æ²¿ã£ã¦é©å½ãªãã®ãé¸æããã Documents/ è¨å®ã«ãã£ã¦å ±æã§ããã®ã§ã¦ã¼ã¶ã¼ã«è¦ããããã¡ã¤ã«ã®ã¿ä¿åãã ï¼Realm ã®ãã¡ã¤ã«ã¯ããã©ã«ãã§ããã«ä¿åãããã¿ããã§ãï¼ iCloud ã§ããã¯ã¢ããããã Documents/Inbox ä»ã®ã¢ããªãããã¡ã¤ã«ãåãåãã¨ãã«ä½¿ç¨ãããã£ã¬ã¯ã㪠iCloud ã§ããã¯ã¢ããããã åé¤ã¯ã§ãããç·¨éã¯ä¸å¯ Library/ ã¦ã¼ã¶ã¼ã«è¦ããããªããã¡ã¤ã«ãä¿åãã iCloud ã§ããã¯ã¢ããããã Library/Caches ãããã
class NamedShape { var numberOfSides: Int = 0 var name: String init(name: String) { self.name = name } func simpleDescription() -> String { return "A shape with \(numberOfSides) sides." } } class NamedShape(name: String) { var numberOfSides: Int = 0 var name: String = "" init { this.name = name } fun simpleDescription() : String { return "A shape with ${numberOfSides} sides." } } class Square: Nam
ã¯ããã« iOS Advent Calendar 2020 17æ¥ç®ã§ãã 2å¹´åãããiOSã¢ããªéçºãã¦ãã¦ããã¨ããç¬éãã¾ã¨ãã¾ããã(iOSã¨ãswiftã«éã£ã話ãããªãå¦ã³ããããã©ã) ããã°ããªãã¦ãèªãããã©ããªãã¨ãªãåå¼·ã«ããªãè¨äºãç®æãã¾ããã ã¿ã¤ãã«ã«è¿ãæ¹ãåæ©çãªãã¤ã§ãã ããæéããã°ã¿ã¦ããã ããã¨å¬ããã§ãã ãåæ¸ã è¿ãå¤ã§Boolãè¿ãæã¯ãã®Boolèªèº«ãè¿ãã°ãã ä¸é æ¼ç®åã使ãã¨if else ãã¯ã³ã©ã¤ãã¼ã§æ¸ãã var +=ã¯è¨ç®åããããã£ã«ã§ããã ãã¹ãã¯æ©æreturnã§æ¸ããã 2éå¦å®ã¯ifã§ããã åãæ確ãªæã®initializerã¯.initã«çç¥ã§ãã trailing closureã¯å¼æ°ããçç¥ã§ãã enumã¨switchãçµã¿åããã¦ç¶²ç¾ æ§ããã§ãã¯ãã Boolå¤ãè¤æ°ããå ´åã®å ´ååãã¯swit
import UIKit class ViewController: UIViewController { // ãã¿ã³ãç¨æ var addBtn: UIBarButtonItem! override func viewDidLoad() { super.viewDidLoad() // ã¿ã¤ãã«ãä»ãã¦ããã¾ããã self.title = "Home" // addBtnãè¨ç½® addBtn = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: "onClick") self.navigationItem.rightBarButtonItem = addBtn } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning
ãã®è¨äºãæ¸ãã¦ããåã«ãå¼ç¤¾ã®äººäºå ¼éçºè ã æªçµé¨ã®iOSã¨ã³ã¸ãã¢ãæ¡ç¨ããéã«è¦ã¦ããã㨠ãã¾ã¨ãã¦ããã¾ãã®ã§åèã¾ã§ã«ã覧ãã ãã https://note.com/bari555/n/n5921e83378fa å¤ãã®åå¦è ãç¡é§ãªã¤ã³ãããããããã¦ãã èªåãããã ã£ãã®ã§ããã ãã©ãã¾ã§åå¼·ããã°å®åã«å ¥ããã®ãã ãä½ãåå¼·ãããè¯ãã®ãã ããããããããè²ã ãªè¨èª(ï¼æ¡)ãæµ ã触ãã ããªãæéãç¡é§ã«ããã®ã§ãä»ã®æªçµé¨ã®æ¹ã« ãããã£ããã¨ããªãããã«ããã«ãã¼ãããããæ®ãã¦ããããã¨æãã¾ãã ããã°ã©ãã³ã°ã§ã¯å ¨ã¦ãç¶²ç¾ ãããã¨ããã¨ããªããªãã®ã§ã ããã¾ã§èªåãæä½éå®åã§ä½¿ã£ã¦ãããå¤ç¨ãã¦ãããã¨ã«çµã£ã¦ãã¾ãã ã¾ããã¹ãã«ã¯è¨¼æããªããã°ãªããªãã®ã§ã æ·±ã¼ã£ãã¢ããªãä½ãå¿ è¦ãããã¾ãã
label.text = { if /* condition */ { return "a" } else if /* condition */ { return "b" } else { return nil } }() ãã®å¦çã®æå³ããã¨ããã¯ãlabel.text ã®å¤ãæ¡ä»¶ã«å¿ãã¦è¨å®ãã¦ããããªã®ã§ãããbefore ã®å ´åããä½ãæ¡ä»¶åå²ãã¦ããªããªã©ã®ä¼ããããã¨ã®æ¬è³ªã¨ã¯å°ãå¤ããã¹ããããèªã¿æã«"æå"ã«èãããã¦ãã¾ããã¡ã§ãã ãããããã®æ¡ä»¶ã®ã¨ããä½ããããã®ããªãâããªãã»ã©ãlabel.text ã®å¤ãè¨å®ãã¦ããã®ã ããããããããããã¦ãlabel.text ã§ã¯ãªããã®ã«å¯¾ãã¦ã®å¦çãç´ãã¦ãªããï¼ãâãç´ãããªããlabel.text ã®å¤ãè¨å®ãã¦ããã®ã ãã¨ãå¿é ããã¦ãã¾ãããããã¾ããã ä¸æ¹ãafter ã®ããã«ããã¨ããã®å¦ç群ãä½ãã
éææ´æ°ãã¾ã æ¢åã®ããã¸ã§ã¯ãã«ããã«å°å ¥ã§ããã¡ãã£ã¨ãããªãã¡ã¯ã¿ãªã³ã°ã®ã¢ã¤ãã£ã¢ãéãã¦ã¿ã¾ããã ããããã¢ã¤ãã£ã¢ãç©æ¥µçã«åãå ¥ãã¦ãã·ã³ãã«ã§ç¾ããã³ã¼ããç®æãã¾ãããã How to slim down your viewDidLoad() method ãããã¯ã¼ã¯éä¿¡ããã¥ã¼ã®è¨å®çãå¤ãã®åæåå¦çã§è¨ããã viewDidLoad()ã¡ã½ãããã¹ãªã ã«ãããã¨ãã話ã override func viewDidLoad() { super.viewDidLoad() // åãã¥ã¼ã®è¨å®ãªã©... // APIãããã¼ã¿ãåå¾ let request = ListOrders.FetchOrders.Request() interactor?.fetchOrders(request: request) // ä»ã®ä½ã... }
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}