u/michael-g-milesin r/swift • Recommends
Populate TableView using URLSession & JSONDecoder in 4 Steps
#uitableview#urlsession#jsondecoder
984 subscribers • 6 videos on Hallway
Beginner. No background in the topic needed.
3.5K views6 years ago1 recommendation
Mobile developmentWeb developmentSwiftiOS and SwiftUIHTTP, REST and GraphQL
Michael Miles demonstrates how to fetch data from a REST API using URLSession, decode it with JSONDecoder, and display it in a UITableView.
Hey! In this video, we fill out a TableView using the PokeAPI found at pokeapi.co. To do this, we use URLSession and the JSON Decoder. We also update the TableView with the data, which can be kind of tricky to time properly, so we use the DispatchQueue and booleans to control the data flow for us. Starter Project: github.com/michaelmiles1/JSONDecoder/tree/starter Finished Project: github.com/michaelmiles1/JSONDecoder/tree/final Steps: 1) Analyze & Map JSON to fit your app’s needs 2) Create Structs conforming to Codable protocol Optional) Add CodingKeys to create readable Structs 3) Call Decoder in URLSession DataTask 4) Populate UI w/ returned data Twitter: twitter.com/MilesOfTweets Instagram: instagram.com/michaelmilestv/u/michael-g-milesin r/swift • Recommends