/realm_api.swift Secret
Last active
July 6, 2017 21:31
Star
You must be signed in to star a gist
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
/* | |
Operations on context | |
*/ | |
protocol StorageContext { | |
/* | |
Create a new object with default values | |
return an object that is conformed to the `Storable` protocol | |
*/ | |
func create<T: Storable>(_ model: T.Type, completion: @escaping ((T) -> Void)) throws | |
/* | |
Save an object that is conformed to the `Storable` protocol | |
*/ | |
func save(object: Storable) throws | |
/* | |
Update an object that is conformed to the `Storable` protocol | |
*/ | |
func update(block: @escaping () -> ()) throws | |
/* | |
Delete an object that is conformed to the `Storable` protocol | |
*/ | |
func delete(object: Storable) throws | |
/* | |
Delete all objects that are conformed to the `Storable` protocol | |
*/ | |
func deleteAll<T: Storable>(_ model: T.Type) throws | |
/* | |
Return a list of objects that are conformed to the `Storable` protocol | |
*/ | |
func fetch<T: Storable>(_ model: T.Type, predicate: NSPredicate?, sorted: Sorted?, completion: (([T]) -> ())) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment