Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created May 16, 2016 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jugyo/5e569c6ffd58e1198123327303dc3dd0 to your computer and use it in GitHub Desktop.
Save jugyo/5e569c6ffd58e1198123327303dc3dd0 to your computer and use it in GitHub Desktop.
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