diff options
author | Vitaly Takmazov | 2018-12-02 23:23:31 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-12-02 23:23:31 +0300 |
commit | a293a8e049fea49b8c2b8262fb92a29f73d66989 (patch) | |
tree | 2201a139fc19fcac59714e915f08b0aa7e816517 /Juick/Model/Attachment.m | |
parent | 3bc3a38be7ccaf9622bdc86ffac37827af36f0f1 (diff) |
Drop YYModel
Diffstat (limited to 'Juick/Model/Attachment.m')
-rw-r--r-- | Juick/Model/Attachment.m | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Juick/Model/Attachment.m b/Juick/Model/Attachment.m index a54e462..006b72e 100644 --- a/Juick/Model/Attachment.m +++ b/Juick/Model/Attachment.m @@ -10,4 +10,21 @@ @implementation Attachment ++(Attachment *) fromJSON:(NSDictionary *)jsonData { + Attachment *attachment = [Attachment new]; + attachment.url = jsonData[@"url"]; + attachment.width = jsonData[@"width"]; + attachment.height = jsonData[@"height"]; + if (jsonData[@"small"]) { + attachment.small = [Attachment fromJSON:jsonData[@"small"]]; + } + if (jsonData[@"medium"]) { + attachment.medium = [Attachment fromJSON:jsonData[@"medium"]]; + } + if (jsonData[@"thumbnail"]) { + attachment.thumbnail = [Attachment fromJSON:jsonData[@"thumbnail"]]; + } + return attachment; +} + @end |