Showing
1 changed file
with
48 additions
and
0 deletions
| ... | @@ -1105,6 +1105,8 @@ public class swiftApi { | ... | @@ -1105,6 +1105,8 @@ public class swiftApi { |
| 1105 | private var category_title: String? | 1105 | private var category_title: String? |
| 1106 | private var banner_img: String? | 1106 | private var banner_img: String? |
| 1107 | private var banner_title: String? | 1107 | private var banner_title: String? |
| 1108 | + private var start_date: String? | ||
| 1109 | + private var end_date: String? | ||
| 1108 | private var unifiedCampaign: UnifiedCampaignModel? | 1110 | private var unifiedCampaign: UnifiedCampaignModel? |
| 1109 | 1111 | ||
| 1110 | public init() { | 1112 | public init() { |
| ... | @@ -1132,6 +1134,8 @@ public class swiftApi { | ... | @@ -1132,6 +1134,8 @@ public class swiftApi { |
| 1132 | self.category_title = "" | 1134 | self.category_title = "" |
| 1133 | self.banner_img = "" | 1135 | self.banner_img = "" |
| 1134 | self.banner_title = "" | 1136 | self.banner_title = "" |
| 1137 | + self.start_date = "" | ||
| 1138 | + self.end_date = "" | ||
| 1135 | self.unifiedCampaign = swiftApi.UnifiedCampaignModel() | 1139 | self.unifiedCampaign = swiftApi.UnifiedCampaignModel() |
| 1136 | } | 1140 | } |
| 1137 | 1141 | ||
| ... | @@ -1150,6 +1154,32 @@ public class swiftApi { | ... | @@ -1150,6 +1154,32 @@ public class swiftApi { |
| 1150 | self.ccms = nil | 1154 | self.ccms = nil |
| 1151 | self.unifiedCampaign = swiftApi.UnifiedCampaignModel() | 1155 | self.unifiedCampaign = swiftApi.UnifiedCampaignModel() |
| 1152 | 1156 | ||
| 1157 | + let startDateString = dictionary["start_date"] as? String? ?? "" | ||
| 1158 | + // Example expirationString: "start_date" = "2022-06-29 00:00:00"; | ||
| 1159 | + | ||
| 1160 | + let dateFormatter = DateFormatter() | ||
| 1161 | + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||
| 1162 | + if let date = dateFormatter.date(from: startDateString ?? "") { | ||
| 1163 | + dateFormatter.dateFormat = "dd/MM/yyyy" | ||
| 1164 | + let resultString = dateFormatter.string(from: date) | ||
| 1165 | + self.start_date = resultString | ||
| 1166 | + } else { | ||
| 1167 | + self.start_date = "" | ||
| 1168 | + } | ||
| 1169 | + | ||
| 1170 | + let endDateString = dictionary["end_date"] as? String? ?? "" | ||
| 1171 | + // Example expirationString: "end_date" = "2024-11-30 12:00:00"; | ||
| 1172 | + | ||
| 1173 | + let dateFormatter2 = DateFormatter() | ||
| 1174 | + dateFormatter2.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||
| 1175 | + if let date = dateFormatter2.date(from: endDateString ?? "") { | ||
| 1176 | + dateFormatter2.dateFormat = "dd/MM/yyyy" | ||
| 1177 | + let resultString = dateFormatter2.string(from: date) | ||
| 1178 | + self.end_date = resultString | ||
| 1179 | + } else { | ||
| 1180 | + self.end_date = "" | ||
| 1181 | + } | ||
| 1182 | + | ||
| 1153 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] | 1183 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] |
| 1154 | if let extra_fields = dictionary["extra_fields"] as? [String: Any] { | 1184 | if let extra_fields = dictionary["extra_fields"] as? [String: Any] { |
| 1155 | self.subcategory = extra_fields["subcategory"] as? String? ?? "" | 1185 | self.subcategory = extra_fields["subcategory"] as? String? ?? "" |
| ... | @@ -1400,6 +1430,24 @@ public class swiftApi { | ... | @@ -1400,6 +1430,24 @@ public class swiftApi { |
| 1400 | self.unifiedCampaign = newValue | 1430 | self.unifiedCampaign = newValue |
| 1401 | } | 1431 | } |
| 1402 | } | 1432 | } |
| 1433 | + | ||
| 1434 | + public var _start_date: String? { | ||
| 1435 | + get { // getter | ||
| 1436 | + return self.start_date | ||
| 1437 | + } | ||
| 1438 | + set(newValue) { //setter | ||
| 1439 | + self.start_date = newValue | ||
| 1440 | + } | ||
| 1441 | + } | ||
| 1442 | + | ||
| 1443 | + public var _end_date: String? { | ||
| 1444 | + get { // getter | ||
| 1445 | + return self.end_date | ||
| 1446 | + } | ||
| 1447 | + set(newValue) { //setter | ||
| 1448 | + self.end_date = newValue | ||
| 1449 | + } | ||
| 1450 | + } | ||
| 1403 | } | 1451 | } |
| 1404 | 1452 | ||
| 1405 | public class CampaignDataModel { | 1453 | public class CampaignDataModel { | ... | ... |
-
Please register or login to post a comment