Created
November 8, 2013 11:39
-
-
Save brutella/7369829 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
NSExpression *minExpression = [NSExpression expressionForFunction:@"stddev:" arguments:@[ [NSExpression expressionForKeyPath:@"amount"] ]]; | |
NSString *stdKey = @"std"; | |
NSExpressionDescription *stdExpressionDescription = [[NSExpressionDescription alloc] init]; | |
stdExpressionDescription.name = stdKey; | |
stdExpressionDescription.expression = minExpression; | |
stdExpressionDescription.expressionResultType = NSFloatAttributeType; | |
__block NSDictionary *dictionary = nil; | |
[context performBlockAndWait:^{ | |
NSFetchRequest *fetchRequest = [...] | |
fetchRequest.propertiesToFetch = @[ stdExpressionDescription ]; | |
NSError *fetchError = nil; | |
NSArray *result = [context executeFetchRequest:fetchRequest error:&fetchError]; | |
[...] | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment