Skip to content

Instantly share code, notes, and snippets.

@PraveenKommuri
Created March 25, 2021 00:15
Show Gist options
  • Save PraveenKommuri/8f15219d0e50c58c61a0fd301082d58b to your computer and use it in GitHub Desktop.
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.
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