Alamofire

// // ViewController.swift // almo4-5 // // Created by Yogesh Tomar on 1/18/19. // Copyright &copy; 2019 Yogesh Tomar. All rights reserved. // import UIKit import Alamofire class ViewController: UIViewController { @IBOutlet weak var priceLabel: UILabel! static let Result = "Result" // static let Result = "Result" override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. priceLabel.text = "..." Alamofire.request("https://myinboxhub.co.in/APIS/services/IOSApiSimpleData").responseJSON{ response in // print(response) if let bitcoinJSON = response.result.value{ let bitcoinObject:Dictionary = bitcoinJSON as! Dictionary<String, Any> print(bitcoinObject) if let weatherArray = bitcoinObject["Result"] as? [[String:Any]], let weather = weatherArray.first { print(weather["name"]!) let name = weather["name"]!; // self.priceLabel.text = "$\(name)" self.priceLabel.text = "\(name)" } // let resultObject:Dictionary = bitcoinObject[ViewController.Result] as! Dictionary<String, Any> // print(resultObject) // let name:String = resultObject["name"] as! String } } print("loading web servoices") } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
Deepak Sharma
Asked 24-07-2024
18

Submit your answer