This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //NSPersistentContainer内のNSManagedObjectContextを定数contextに代入 | |
| let context = persistentContainer.viewContext | |
| //NSManagedObjectContextに変更があったら、保存しますよ | |
| if context.hasChanges { | |
| do { | |
| //NSManagedObjectContextの内容を保存するよ | |
| try context.save() | |
| } catch { | |
| //なんかエラーがあったらエラーを吐くよ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test |