UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Post 200 with username & Password login

Forums > SwiftUI

I am having a very hard time in finding any informaiton on how I can do a Post by logging into the server with these parameters

let parameters: Parameters = ["username": username, "password": password]

and my return from the server would be

if let userID = jsonResponse["user_id"] as? String, let customerID = jsonResponse["customer_id"] as? String

Can someone please help me on where I can this information.

3      

Hello, without 3rd party libraries you can use URLSession. For example like in this gist - https://gist.github.com/dmathewwws/63064a4114fba3769448602208f66c0d#file-urlsession-post-swift-L26-L27

You can get an app like Postman, Paw and similar to test sending POST requests before implementing them to validate that server responds correctly.

3      

AFTER viewing this video I was able to understand how it works. Here is the video for anyone who wants to understand Post 200 https://www.youtube.com/watch?v=hDlPaOQOlHs&t=232s

3      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.