Last active
August 13, 2018 14:37
-
-
Save koromiko/4d97e4bc92410f67020295cff8827acf 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 initStubs() { | |
func insertTodoItem( name: String, finished: Bool ) -> ToDoItem? { | |
let obj = NSEntityDescription.insertNewObject(forEntityName: "ToDoItem", into: mockPersistantContainer.viewContext) | |
obj.setValue(name, forKey: "name") | |
obj.setValue(finished, forKey: "finished") | |
return obj as? ToDoItem | |
} | |
insertTodoItem(name: "1", finished: false) | |
insertTodoItem(name: "2", finished: false) | |
insertTodoItem(name: "3", finished: false) | |
insertTodoItem(name: "4", finished: false) | |
insertTodoItem(name: "5", finished: false) | |
do { | |
try mockPersistantContainer.viewContext.save() | |
} catch { | |
print("create fakes error \(error)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment