forked from 2359media/STXDynamicTableView
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTXUser.m
More file actions
38 lines (29 loc) · 1.03 KB
/
STXUser.m
File metadata and controls
38 lines (29 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// STXUser.m
// STXDynamicTableViewExample
//
// Created by Jesse Armand on 9/4/14.
// Copyright (c) 2014 2359 Media Pte Ltd. All rights reserved.
//
#import "STXUser.h"
@interface STXUser ()
@property (copy, nonatomic) NSString *userID;
@property (copy, nonatomic) NSString *username;
@property (copy, nonatomic) NSString *fullname;
@property (copy, nonatomic) NSURL *profilePictureURL;
@end
@implementation STXUser
- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
self = [super init];
if (self) {
NSArray *errors;
NSDictionary *mappingDictionary = @{ @"id": KZProperty(userID),
@"username": KZProperty(username),
@"full_name": KZProperty(fullname),
@"profile_picture": KZBox(URL, profilePictureURL) };
[KZPropertyMapper mapValuesFrom:dictionary toInstance:self usingMapping:mappingDictionary errors:&errors];
}
return self;
}
@end