Im wanting to split up https://blockchain.info/ticker so that each line is its own string in an array.
Im making an app that get the price of the selected currency. So if someone wants AUD then it will get the 2 string in the array and then show the price which is in the last tag.
I currently just have it downloading the json..
func reloadJson(){
if globalVariables.currencySelected == "" {
globalVariables.currencySelected = globalVariables.currencySelected + "AUD"
}
print(globalVariables.currencySelected)
if let blockchainTickerURL = URL(string: "https://blockchain.info/ticker") {
let request = NSMutableURLRequest(url: blockchainTickerURL)
let task = URLSession.shared.dataTask(with: request as URLRequest) {
data, response, error in
var message = ""
if error != nil {
print("error")
} else {
if let unwrappedData = data {
let dataString = NSString(data: unwrappedData, encoding: String.Encoding.utf8.rawValue)
Thats just a copy and paste of what I currently have, its not exactly formatted right.
Thanks
See Question&Answers more detail:os