Call Post API Using URLSession & URLRequest in Swift import UIKit import PlaygroundSupport PlaygroundPage. current . needsIndefiniteExecution = true struct APIURL EndPoint { static let registerUser = " https://api-dev-scus-demo.azurewebsites.net/api/User/RegisterUser " static let getUser = " https://api-dev-scus-demo.azurewebsites.net/api/User/GetUser " } struct User { func registerUser () { // code to register user var urlRequest = URLRequest ( url : URL ( string : APIURL EndPoint . registerUser ) ! ) urlRequest. httpMethod = " post " let dataDictionary = [ " name " : " codecat15 " , " email " : " codecat15@gmail.com " , " password " : " 1234 " ] do { let requestBody = try JSONSerialization. data ( withJSONObject : dataDictionary, options : . prettyPrinted ) urlRequest. ...
EasyLearningTechHub is a smart learning platform created to make technology simple, practical, and accessible for everyone. 🚀 We focus on teaching in an easy, step-by-step way so learners can understand concepts clearly, even if they are beginners. Our content covers programming, mobile app development, software tools, and the latest tech trends with real-world examples and hands-on guidance. Our mission is to empower learners to grow, innovate, and achieve faster with EasyLearningTechHub. 🌟