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
let postsURLEndPoint: String = "https://jsonplaceholder.typicode.com/posts/1" | |
Alamofire.request(postsURLEndPoint) | |
.responseJSON { response in | |
guard let json = response.result.value as? [String:Any] else { | |
// Did not get JSON object | |
return | |
} | |
// Do something with JSON | |
} |
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
let postsURLEndPoint: String = "https://jsonplaceholder.typicode.com/posts/1" | |
Alamofire.request(postsURLEndPoint) | |
.responseJSON { response in | |
print(response.result.value) | |
} |
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
let postsURLEndPoint: String = "https://jsonplaceholder.typicode.com/posts/1" | |
Alamofire.request(postsURLEndPoint, method: .get) | |
.responseJSON { response in | |
print(response) | |
} | |
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
SUCCESS: { | |
body = "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"; | |
id = 1; | |
title = "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"; | |
userId = 1; | |
} |
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
let postsURLEndPoint: String = "https://jsonplaceholder.typicode.com/posts/1" | |
Alamofire.request(postsURLEndPoint) | |
.responseJSON { response in | |
print(response) | |
} |
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
yourLabel.formatNumber(number: 12345) |
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
extension UILabel { | |
func formatNumber(number: NSNumber) { | |
let formatter = NumberFormatter() | |
formatter.numberStyle = .decimal | |
let numberAsString = formatter.string(from: number) | |
self.text = numberAsString | |
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
extension UILabel { | |
func formatNumber(number: NSNumber) { | |
let formatter = NumberFormatter() | |
formatter.numberStyle = .decimal | |
} | |
} |
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
extension UILabel { | |
func formatNumber(number: NSNumber) { | |
} | |
} |
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
extension UILabel { | |
} |