Showing
1 changed file
with
47 additions
and
0 deletions
| ... | @@ -1069,6 +1069,8 @@ public class swiftApi { | ... | @@ -1069,6 +1069,8 @@ public class swiftApi { |
| 1069 | private var category_title: String? | 1069 | private var category_title: String? |
| 1070 | private var banner_img: String? | 1070 | private var banner_img: String? |
| 1071 | private var banner_title: String? | 1071 | private var banner_title: String? |
| 1072 | + private var start_date: String? | ||
| 1073 | + private var end_date: String? | ||
| 1072 | 1074 | ||
| 1073 | public init() { | 1075 | public init() { |
| 1074 | self.index_url = "" | 1076 | self.index_url = "" |
| ... | @@ -1095,6 +1097,8 @@ public class swiftApi { | ... | @@ -1095,6 +1097,8 @@ public class swiftApi { |
| 1095 | self.category_title = "" | 1097 | self.category_title = "" |
| 1096 | self.banner_img = "" | 1098 | self.banner_img = "" |
| 1097 | self.banner_title = "" | 1099 | self.banner_title = "" |
| 1100 | + self.start_date = "" | ||
| 1101 | + self.end_date = "" | ||
| 1098 | } | 1102 | } |
| 1099 | 1103 | ||
| 1100 | public init(dictionary: [String: Any]) { | 1104 | public init(dictionary: [String: Any]) { |
| ... | @@ -1111,6 +1115,31 @@ public class swiftApi { | ... | @@ -1111,6 +1115,31 @@ public class swiftApi { |
| 1111 | self.sorting = dictionary["sorting"] as? Int? ?? 0 | 1115 | self.sorting = dictionary["sorting"] as? Int? ?? 0 |
| 1112 | self.ccms = nil | 1116 | self.ccms = nil |
| 1113 | 1117 | ||
| 1118 | + let startDateString = dictionary["start_date"] as? String? ?? "" | ||
| 1119 | + // Example expirationString: "start_date" = "2022-06-29 00:00:00"; | ||
| 1120 | + let dateFormatter = DateFormatter() | ||
| 1121 | + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||
| 1122 | + if let date = dateFormatter.date(from: startDateString ?? "") { | ||
| 1123 | + dateFormatter.dateFormat = "dd/MM/yyyy" | ||
| 1124 | + let resultString = dateFormatter.string(from: date) | ||
| 1125 | + self.start_date = resultString | ||
| 1126 | + } else { | ||
| 1127 | + self.start_date = "" | ||
| 1128 | + } | ||
| 1129 | + | ||
| 1130 | + let endDateString = dictionary["end_date"] as? String? ?? "" | ||
| 1131 | + // Example expirationString: "end_date" = "2024-11-30 12:00:00"; | ||
| 1132 | + let dateFormatter2 = DateFormatter() | ||
| 1133 | + dateFormatter2.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||
| 1134 | + if let date = dateFormatter2.date(from: endDateString ?? "") { | ||
| 1135 | + dateFormatter2.dateFormat = "dd/MM/yyyy" | ||
| 1136 | + let resultString = dateFormatter2.string(from: date) | ||
| 1137 | + self.end_date = resultString | ||
| 1138 | + } else { | ||
| 1139 | + self.end_date = "" | ||
| 1140 | + } | ||
| 1141 | + | ||
| 1142 | + | ||
| 1114 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] | 1143 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] |
| 1115 | if let extra_fields = dictionary["extra_fields"] as? [String: Any] { | 1144 | if let extra_fields = dictionary["extra_fields"] as? [String: Any] { |
| 1116 | self.subcategory = extra_fields["subcategory"] as? String? ?? "" | 1145 | self.subcategory = extra_fields["subcategory"] as? String? ?? "" |
| ... | @@ -1352,6 +1381,24 @@ public class swiftApi { | ... | @@ -1352,6 +1381,24 @@ public class swiftApi { |
| 1352 | self.banner_title = newValue | 1381 | self.banner_title = newValue |
| 1353 | } | 1382 | } |
| 1354 | } | 1383 | } |
| 1384 | + | ||
| 1385 | + public var _start_date: String? { | ||
| 1386 | + get { // getter | ||
| 1387 | + return self.start_date | ||
| 1388 | + } | ||
| 1389 | + set(newValue) { //setter | ||
| 1390 | + self.start_date = newValue | ||
| 1391 | + } | ||
| 1392 | + } | ||
| 1393 | + | ||
| 1394 | + public var _end_date: String? { | ||
| 1395 | + get { // getter | ||
| 1396 | + return self.end_date | ||
| 1397 | + } | ||
| 1398 | + set(newValue) { //setter | ||
| 1399 | + self.end_date = newValue | ||
| 1400 | + } | ||
| 1401 | + } | ||
| 1355 | } | 1402 | } |
| 1356 | 1403 | ||
| 1357 | public class CampaignDataModel { | 1404 | public class CampaignDataModel { | ... | ... |
-
Please register or login to post a comment