added

[iOS SDK] Added uploaderAdditionalFields to PXLPhoto

Relase note

Overview

If you upload content via our API with connected_user to store your own customizable JSON data. Then, on our SDK, you will get it in PXLPhoto.uploaderAdditionalFields.

  • Added uploaderAdditionalFields to PXLPhoto that can accommodate dynamic and nested JSON

Example

   #!swift
   if let album = album {
            _ = PXLClient.sharedClient.loadNextPageOfPhotosForAlbum(album: album) { photos, _ in
                if let photos = photos {
                    self.pxlGridView.items = photos

                    // demonstrating the customized json uploaded by API
                    for photo in photos {
                        debugPrint("userAdditional: \(photo.uploaderAdditionalFields)")
                        if let item = photo.uploaderAdditionalFields?["age"] as? Int {
                            debugPrint(" - age: \(item)")
                        }

                        if let item = photo.uploaderAdditionalFields?["points"] as? [Double] {
                            debugPrint(" - points: \(item)")
                        }

                        if let item = photo.uploaderAdditionalFields?["goods"] as? [String:Any] {
                            debugPrint(" - goods Json Array: \(item)")
                        }

                        if let item = photo.uploaderAdditionalFields?["goods"] as? [String] {
                            debugPrint(" - goods String Array: \(item)")
                        }
                    }
                }
            }
        }

Console

 "userAdditional: Optional([\"goods\": [\"price\": \"150\", \"currency\": \"UDS\", \"title\": \"air pods 1gen\"], \"name\": \"Sample data\", \"points\": [10.0, 20.0, 35.0], \"age\": 73])"
 " - age: 73"
 " - points: [10.0, 20.0, 35.0]"
 " - goods Json Array: [\"price\": \"150\", \"currency\": \"UDS\", \"title\": \"air pods 1gen\"]"
 "userAdditional: Optional([\"email\": \"[email protected]\", \"age\": 73, \"name\": \"Donald Trump\", \"points\": [10.0, 20.0, 35.0]])"
 " - age: 73"
 " - points: [10.0, 20.0, 35.0]"
 " - goods String Array: [\"Macbook 2021\", \"air pods\", \"iPhone 12 Pro\"]"