Skip to content
0:00 / 0:00

#urlsession#urlrequest#json

URLSession in 6 Steps - GET and POST (Swift)

Michael Miles

984 subscribers • 6 videos on Hallway

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

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/

Why it's here

1 person recommends this

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

URLSession in 6 Steps - GET and POST (Swift)