Created
September 7, 2017 02:14
-
-
Save koromiko/3a0361fcfbbd6dfab32463c33c0769ef 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
func flushData() { | |
let fetchRequest:NSFetchRequest<NSFetchRequestResult> = NSFetchRequest<NSFetchRequestResult>(entityName: "ToDoItem") | |
let objs = try! mockPersistantContainer.viewContext.fetch(fetchRequest) | |
for case let obj as NSManagedObject in objs { | |
mockPersistantContainer.viewContext.delete(obj) | |
} | |
try! mockPersistantContainer.viewContext.save() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment