Created
June 3, 2019 12:23
-
-
Save balrajOla/ce0e90c712028063944b2eb15d67bd4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let myStruct = try JSONDecoder().decode(Content.self, from: json) // decoding our data | |
myStruct.body.forEach { bodyContent in | |
let value: String? = bodyContent.content?.getContent() | |
let intValue: Int? = bodyContent.content?.getContent() | |
let finalValue = value ?? intValue.map(String.init) ?? "NA" | |
print("Data for type: \(bodyContent.type) is Data: \(finalValue)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment