Created
April 10, 2016 21:59
-
-
Save vikdenic/335326c147c753fa86f8be6819865541 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 retrieveAllUsers(withNameLike name : String, completed : ((users : [BackendlessUser]?, fault : Fault?) -> Void)?) { | |
let backendless = Backendless.sharedInstance() | |
let query = BackendlessDataQuery() | |
// Use backendless.persistenceService to obtain a ref to a data store for the class | |
let whereClause = "name LIKE '\(name)'" | |
query.whereClause = whereClause | |
let dataStore = backendless.persistenceService.of(BackendlessUser.ofClass()) as IDataStore | |
dataStore.find(query, response: { (retrievedCollection) -> Void in | |
print("Successfully retrieved collection") | |
completed!(users: retrievedCollection.data as? [BackendlessUser], fault: nil) | |
}) { (fault) -> Void in | |
print("Server reported an error: \(fault)") | |
completed!(users: nil, fault: fault) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment