Created
April 30, 2017 19:57
-
-
Save javalnanda/1dbb4bd364338f5528ed80aabe26d66b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| func fetchData(){ | |
| UIApplication.shared.isNetworkActivityIndicatorVisible = true | |
| let apiUrl = "https://raw.githubusercontent.com/javalnanda/AlamofireObjectMapperSample/master/AOMsample.json" | |
| Alamofire.request(apiUrl).validate().responseArray(keyPath: "result") { (response: DataResponse<[Project]>) in | |
| UIApplication.shared.isNetworkActivityIndicatorVisible = false | |
| switch response.result { | |
| case .success: | |
| self.projects = response.result.value ?? [] | |
| for project in self.projects { | |
| print(project.name) | |
| } | |
| case .failure(let error): | |
| print(error) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment