// // Attachment.m // Juick // // Created by Vitaly Takmazov on 15/10/2017. // Copyright © 2017 com.juick. All rights reserved. // #import "Attachment.h" @implementation Attachment +(Attachment *) fromJSON:(NSDictionary *)jsonData { if (jsonData[@"url"]) { 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; } return nil; } @end