Last active
August 29, 2015 14:07
-
-
Save mmesarina/e3e2260aee4cf3a66806 to your computer and use it in GitHub Desktop.
RottenTomatoes Movie.m
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
| - (id)initWithDictionary: (NSDictionary*)dictionary { | |
| self = [super init]; | |
| if (self ) { | |
| self.title = dictionary[@"title"]; | |
| self.synopsis = dictionary[@"synopsis"]; | |
| NSMutableArray *castArray = [[NSMutableArray alloc] init]; | |
| NSArray *abridged_cast = dictionary[@"abridged_cast"]; | |
| for (id dict in abridged_cast) { | |
| [castArray addObject:dict[@"name"]]; | |
| } | |
| self.cast = [castArray componentsJoinedByString:@","]; //returns contents of array as string separated by commas | |
| NSDictionary *ratingsDict = [[NSDictionary alloc] init]; | |
| ratingsDict = dictionary[@"ratings"]; | |
| self.ratings =[NSString stringWithFormat:@"%@",ratingsDict[@"audience_score"]]; | |
| NSDictionary *posters = dictionary[@"posters"]; | |
| self.imageURL = posters[@"detailed"]; | |
| } | |
| return self; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment