Manos Chorianopoulos

update CampaignItemModel

......@@ -395,6 +395,8 @@ public class swiftApi {
public let subcategory: String?
public let is_new: Bool?
public let message: String?
public let loyaltyCampaignId: String?
public let hasExtraFields: Bool?
init(dictionary: [String: Any]) {
self.index_url = dictionary["index_url"] as? String? ?? ""
......@@ -416,12 +418,18 @@ public class swiftApi {
{
extra_fields_parsed = jsonArray;
self.subcategory = extra_fields_parsed["subcategory"] as? String? ?? ""
self.loyaltyCampaignId = extra_fields_parsed["loyaltyCampaignId"] as? String? ?? ""
self.hasExtraFields = true
} else {
self.subcategory = ""
self.loyaltyCampaignId = ""
self.hasExtraFields = false
print("bad json")
}
} catch let error as NSError {
self.subcategory = ""
self.loyaltyCampaignId = ""
self.hasExtraFields = false
print(error)
}
......