title: How to display JSON data from API in SwiftUI?
body: <p>I have an JSON that comes from an API. I need to show as a text a value from it.</p>
  
  <p>This is a piece of it.</p>
  
  <pre><code>]
      {
          "d": "2019-09-20",
          "v": 56.62
      },
      {
          "d": "2019-09-23",
          "v": 56.93
      }
  ]
  </code></pre>
  
  <p>Now, I created the model for it, called <code>Dolar.swift</code>.</p>
  
  <pre><code>struct Dolar: Decodable {
      var d: String?
      var v: Double?
  }
  </code></pre>
  
  <p>And also a class called <code>WebService.swift</code> that will handle the call:</p>
  
  <pre><code>class WebService {
      func getCurrency(completion: @escaping (Dolar?) -&gt; ()) {
          guard let url = URL(string: "https://api.estadisticasbcra.com/usd_of") else { return }
  
          URLSession.shared.dataTask(with: url) { (data, response, error) in
              guard let data = data, error == nil else {
                  return
              }
  
              let currencyResponse = try? JSONDecoder().decode(Dolar.self, from: data)
  
              if let currencyResponse = currencyResponse {
                  let dolar = currencyResponse
                  print(dolar)
                  completion(dolar)
              } else {
                  completion(nil)
              }
          }.resume()
      }
  }
  </code></pre>
  
  <p>The documentation from the API says it requires a TOKEN be added to the request:</p>
  
  <pre><code>Authorization: BEARER {TOKEN}
  </code></pre>
  
  <p>How do I do that? I have the TOKEN, but don't know how to implement it. That's my first question.
  Second, once I get the value, how do I show it on the <code>ContentView.swift</code>?
  Any help is appreciated.</p>