Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- import SwiftUI
- import Foundation
- struct Ticker: Codable {
- let rate: Int
- }
- if let url = URL(string: "https://api.zonda.exchange/rest/trading/ticker/BTC-PLN") {
- URLSession.shared.dataTask(with: url) { data, response, error in
- if let data = data {
- let jsonDecoder = JSONDecoder()
- do {
- let parsedJSON = try jsonDecoder.decode(Ticker.self, from: data)
- for rate in parsedJSON.rate {
- print(rate)
- }
- } catch {
- print(error)
- }
- }
- }.resume()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement