Created
January 27, 2015 17:04
-
-
Save jeksys/b672a37dd0287596c76c to your computer and use it in GitHub Desktop.
CoreData.Fetch
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 listEntities(managedContext: NSManagedObjectContext, entityName: String, groupBy: Array<String>)->NSArray{ | |
var error: NSError? | |
var results : NSArray = NSArray() | |
let fetchRequest = NSFetchRequest(entityName: entityName) | |
if groupBy.count > 0{ | |
fetchRequest.propertiesToGroupBy = groupBy | |
} | |
if let results = managedContext.executeFetchRequest(fetchRequest, error: &error) { | |
return results | |
} | |
return results | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment