u/michael-g-milesin r/swift • Recommends
URLSession in 6 Steps - GET and POST (Swift)
984 subscribers • 6 videos on Hallway
Beginner. No background in the topic needed.
9.7K views7 years ago1 recommendation
Mobile developmentiOS and SwiftUINetworking and protocols
Michael Miles shows how to use Swift's native URLSession to perform GET and POST network requests and handle JSON data.
In this video, I use Swift's built-in network request handler, URLSession, to retrieve and push data from 2 different sites: api.chucknorris.io & pastebin.com. Steps: 1) Get API keys (as needed) 2) Add any needed add’l variables using URLRequest (parameters, headers) 3) Create instance of a URLSession 4) Create dataTask w/ do-catch block for data 5) Serialize and format data (usually of type JSON) into project 6) Error handling [don’t forget .resume()] Finished project: github.com/mgm720/alamo/tree/final Twitter: twitter.com/MilesOfTweets Instagram: instagram.com/michaelmilestv/What people say. Recommended as a clear guide to using native URLSession for networking in Swift without external libraries.
u/michael-g-milesin r/swift • Recommends