Classes/Recipe.m
/* |
Copyright (C) 2017 Apple Inc. All Rights Reserved. |
See LICENSE.txt for this sample’s licensing information |
Abstract: |
Model class to represent a recipe. |
*/ |
#import "Recipe.h" |
@implementation Recipe |
@dynamic name, image, overview, thumbnailImage, instructions, ingredients, type, prepTime; |
@end |
#pragma mark - |
@implementation ImageToDataTransformer |
+ (BOOL)allowsReverseTransformation { |
return YES; |
} |
+ (Class)transformedValueClass { |
return [NSData class]; |
} |
- (id)transformedValue:(id)value { |
NSData *data = UIImagePNGRepresentation(value); |
return data; |
} |
- (id)reverseTransformedValue:(id)value { |
UIImage *uiImage = [[UIImage alloc] initWithData:value]; |
return uiImage; |
} |
@end |
Copyright © 2017 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2017-07-20