Parsing JSON data is fundamental to any iOS app that performs remote REST API calls.
Thanks to the Codable
protocols introduced in Swift 4, Swift has a native and idiomatic way to parse JSON data.
Paired with the JSONDecoder
class, the Decodable
protocol allows straightforward JSON decoding in a few lines of code and more sophisticated techniques to handle all the possible data formats and edge cases.
Matteo has been developing apps for iOS since 2008. He has been teaching iOS development best practices to hundreds of students since 2015 and he is the developer of Vulcan, a macOS app to generate SwiftUI code. Before that he was a freelance iOS developer for small and big clients, including TomTom, Squla, Siilo, and Layar. Matteo got a master’s degree in computer science and computational logic at the University of Turin. In his spare time he dances and teaches tango.