Skip to content
0:00 / 0:00

#uitableview#urlsession#jsondecoder

Populate TableView using URLSession & JSONDecoder in 4 Steps

Michael Miles

984 subscribers • 6 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Michael Miles
  • Linked in the descriptionmichaelmiles1/JSONDecoder
  • May be out of date. The tools, versions or practices it shows have likely moved on.

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/

Why it's here

1 person recommends this

u/michael-g-milesin r/swift • Recommends

Populate TableView using URLSession & JSONDecoder in 4 Steps