mardi 11 août 2015

Storing App Settings in Swift

I need to seed my database with some 'core' tables on first load of my application. would the best approach to use NSUserDefaults in my AppDelegate:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {


    NSUserDefaults.standardUserDefaults().registerDefaults([
        "hasSeededCoreTables": false

        ])

    return true
}

Or should I create a 'Settings' entity in core data and have a boolean set in there. I need the flag to persist between launches so that we don't have to overwrite the core tables every time the application relaunches

Aucun commentaire:

Enregistrer un commentaire