+ 3
What are the commonly used persistence (data storage) options in Swift?
@SoloLearn - I can understand not going into great detail about NSManagedObject and Core Data in an introductory lesson; but, why not at least inform the learners that there are multiple ways to approach data persistence (local/remote, dictionary, core data, settings, sqlite, document, etc.,) ? I recall an Objective-C lesson (from a different provider) including a brief table summarizing some data storage mechanisms, their abilities, and when to use them. Would be great if that were provided with the Swift lesson. Seems like a large omission. Other SoloLearn language courses spend some time on opening, closing, and manipulating files... and provide brief descriptions of dealing with different kinds of data/formats.
2 Answers
+ 2
Some of the storage/persistance options include:
*- NSMangedObject
* Core Data - higher learning curve, but gains numerous capabilities. Full capabilities are most useful for users with multiple iOS and/or MacOS devices synchronizing via iCloud.
* NSDocument
* UserDefaults: NSData, NSString, NSNumber, NSData, NSArray and NSDictionary
* KeyChain
* Sqlite - most popular use case is cross/multi platform development.
0
NsuserDefault is more commonly used for data permanently saved. But if you have a lot of data then core data is used