Last active
March 28, 2020 15:54
-
-
Save iannase/32a627a16d63a24ade8ea14b913035e8 to your computer and use it in GitHub Desktop.
How to make an API call on JSON data that has an array.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Alamofire.request(apiURL).responseJSON { (response) in | |
if response.result.isSuccess { | |
guard let data = response.result.value as? [String: Any] else { return } | |
guard let results = data["results"] as? NSArray else { return } | |
for result in results { | |
if let result = result as? [String: Any] { | |
if let elevation = result["elevation"] as? Double { | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment