Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (instancetype)init
- {
- self = [super init];
- if (self) {
- self.transport = [[TransportLayer alloc] init];
- }
- return self;
- }
- - (void)getObjectsWithCompletion:(void (^)(NSArray *, NSError *))completion {
- [self.transport getDataWithURL:[NSURL URLWithString:@"http://www.mocky.io/v2/5964f18326000059183d75a7"]
- completion:^(NSArray *array, NSError *error) {
- if (error) {
- completion ? completion(nil, error) : nil;
- } else {
- NSMutableArray *items = [NSMutableArray array];
- for (NSDictionary *item in array) {
- Category *category = [[Category alloc] initWithJSON:item];
- [items addObject:category];
- }
- completion ? completion(items, nil) : nil;
- }
- }];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement