Created
May 16, 2016 18:31
-
-
Save jugyo/5e569c6ffd58e1198123327303dc3dd0 to your computer and use it in GitHub Desktop.
This file contains 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
class func setupRealm() { | |
let config = Realm.Configuration( | |
deleteRealmIfMigrationNeeded: true | |
) | |
Realm.Configuration.defaultConfiguration = config | |
// Test | |
do { | |
try Realm() | |
} catch let error as NSError { | |
print("Realm error: \(error)") | |
do { | |
try NSFileManager.defaultManager().removeItemAtURL(Realm.Configuration.defaultConfiguration.fileURL!) | |
} catch let error as NSError { | |
print("Ooops! Something went wrong: \(error)") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment