title: Show user location on map SwiftUI
body: <p>I am trying to load a map and have the initial location on user's location as well as showing the user's location on the map using SwiftUI. I don't know how to do that in SwiftUI.</p>
  
  <p>I have tried to put 'view.showsUserLocation = true' in updateUIView function but it is not working.</p>
  
  <pre class="lang-swift prettyprint-override"><code>import SwiftUI
  import MapKit
  struct MapView : UIViewRepresentable {
      func makeUIView(context: Context) -&gt; MKMapView {
          MKMapView(frame: .zero)
      }
  
      func updateUIView(_ view: MKMapView, context: Context) {
          view.showsUserLocation = true
          let coordinate = CLLocationCoordinate2D(
              latitude: 34.011286, longitude: -116.166868)
          let span = MKCoordinateSpan(latitudeDelta: 2.0, longitudeDelta: 2.0)
  
          let region = MKCoordinateRegion(center: view.userLocation.location?.coordinate ?? coordinate, span: span)
          view.setRegion(region, animated: true)
      }
  }
  </code></pre>
  
  <p>The location comes nil when I tried to print it.</p>