これははてなエンジニアアドベントカレンダー2022の40日目の記事です。昨日は id:kouki_danのCI/CDサービスのOpenID Connect対応 Dive Intoでした。 16年前の今日、2007年の1月9日は初代iPhoneが発表された日です。思い返すと、初期のiPhoneネイティブアプリ…
ConcurrencyのTaskをCombineのPublisherのように自動キャンセルしたいとき、以下のようなものを用意しておくと便利かもしれない。 extension Task { public func store(in set: inout Set<AnyCancellable>) { set.insert(AnyCancellable { self.cancel() }) } } var cancella</anycancellable>…
基本 let container = NSPersistentContainer(name: "Sample") NSPersistentContainer.init(name:) By default, the provided name value is used to name the persistent store and is used to look up the name of the NSManagedObjectModel object to be …
NSPersistentContainer.loadPersistentStores(completionHandler:)のcompletionHandlerは、デフォルトではloadPersistentStoresを抜ける前に同期的に呼ばれます。 理由 NSPersistentContainer.persistentStoreDescriptions[0].shouldAddStoreAsynchronously…
iOS 13 Core DataとCloudKitを統合したNSPersistentCloudKitContainerが追加された Using Core Data With CloudKit - WWDC 2019 - Videos - Apple Developer iOS 10 NSPersistentContainerが追加された What's New in Core Data - WWDC 2016 - Videos - Appl…