How to work with an api in Swift

Create a URl


let url = URL(string: " your_url")!

Create a URL Session


 let datatask = URLSession.shared.dataTask(with: url) { (data, response, error) in
 
 if let data = data {
 
 print(data)
}else {
print(error)
 }
}
datatask.resume() 

that's all .

3 views0 comments

Recent Posts

See All

How to create a Web View In swift Ios

import UIKit // import webkit framework import WebKit class ViewController: UIViewController, WKNavigationDelegate { // view controller inherit from WkNavigation Delegate // create a object of Wk

 

Follow

  • Facebook
  • Instagram
  • LinkedIn
  • Twitter

Contact

Address

VILLAGE-HiRAPUR KALAN
POST-KARANWAS DIBAI

©2020 by ThE RoYaL LaKsHyA.