Created
October 7, 2015 10:05
-
-
Save wisaruthk/9ab481712cfbf2e16e12 to your computer and use it in GitHub Desktop.
Swift NSBatchUpdateRequest
This file contains hidden or 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
let batchRequest = NSBatchUpdateRequest(entityName: "Group") | |
batchRequest.predicate = NSPredicate(format: "SELF != %@", self.group!) | |
batchRequest.propertiesToUpdate = ["isFirstView":NSNumber(bool: false)] | |
batchRequest.resultType = .UpdatedObjectsCountResultType | |
do { | |
let results:NSBatchUpdateResult = try managedContext.executeRequest(batchRequest) as! NSBatchUpdateResult | |
print("update with result = \(results.result)") | |
} catch { | |
print("Error something..") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment