Created
March 25, 2021 00:15
-
-
Save PraveenKommuri/8f15219d0e50c58c61a0fd301082d58b to your computer and use it in GitHub Desktop.
Function will parse the data object based on model what we pass in decode method.
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
func parse(jsonData: Data) -> sampleRecord? { | |
do { | |
let decodedData = try JSONDecoder().decode(sampleRecord.self, from: jsonData) | |
return decodedData | |
} catch { | |
print("error: \(error)") | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment