Showing
1 changed file
with
27 additions
and
0 deletions
| ... | @@ -538,6 +538,7 @@ public class swiftApi { | ... | @@ -538,6 +538,7 @@ public class swiftApi { |
| 538 | public let uuid: String? | 538 | public let uuid: String? |
| 539 | public let admin_name: String? | 539 | public let admin_name: String? |
| 540 | public let name: String? | 540 | public let name: String? |
| 541 | + public let img: [String]? | ||
| 541 | public let img_preview: String? | 542 | public let img_preview: String? |
| 542 | public let expiration: String? | 543 | public let expiration: String? |
| 543 | public let description: String? | 544 | public let description: String? |
| ... | @@ -608,6 +609,32 @@ public class swiftApi { | ... | @@ -608,6 +609,32 @@ public class swiftApi { |
| 608 | self.expiration = "" | 609 | self.expiration = "" |
| 609 | } | 610 | } |
| 610 | 611 | ||
| 612 | + // img Example | ||
| 613 | + // img = "[\"https://warply.s3.amazonaws.com/applications/f83dfde1145e4c2da69793abb2f579af/couponset/00833266674d4a95b21dc4bf06995548/logo.png\"]"; | ||
| 614 | + | ||
| 615 | + if let imgString = dictionary["img"] as? String { | ||
| 616 | + // Convert the cleaned string to JSON data | ||
| 617 | + if let imgData = imgString.data(using: .utf8) { | ||
| 618 | + do { | ||
| 619 | + // Parse JSON data as an array of dictionaries | ||
| 620 | + if let imgArray = try JSONSerialization.jsonObject(with: imgData, options: []) as? [String] { | ||
| 621 | + | ||
| 622 | + self.img = imgArray | ||
| 623 | + | ||
| 624 | + } else { | ||
| 625 | + self.img = [] | ||
| 626 | + } | ||
| 627 | + } catch { | ||
| 628 | + self.img = [] | ||
| 629 | + print("Error parsing img: \(error)") | ||
| 630 | + } | ||
| 631 | + } else { | ||
| 632 | + self.img = [] | ||
| 633 | + } | ||
| 634 | + } else { | ||
| 635 | + self.img = [] | ||
| 636 | + } | ||
| 637 | + | ||
| 611 | // shop_availability Example | 638 | // shop_availability Example |
| 612 | // {"shop_availability":"[{\"merchant_uuid\": \"9742752bcf904a269707c40b286e66de\", \"product_url\": \"https://www.ab.gr/el/eshop/Galaktokomika-Fytika-Rofimata-and-Eidi-Psygeioy/Gala-and-Fytika-Rofimata/Fytika-Rofimata/Fytiko-Rofima-Amygdalo-Choris-Prosthiki-Zacharis-1lt/p/7438640\"}]"} | 639 | // {"shop_availability":"[{\"merchant_uuid\": \"9742752bcf904a269707c40b286e66de\", \"product_url\": \"https://www.ab.gr/el/eshop/Galaktokomika-Fytika-Rofimata-and-Eidi-Psygeioy/Gala-and-Fytika-Rofimata/Fytika-Rofimata/Fytiko-Rofima-Amygdalo-Choris-Prosthiki-Zacharis-1lt/p/7438640\"}]"} |
| 613 | 640 | ... | ... |
-
Please register or login to post a comment