Skip to content

Instantly share code, notes, and snippets.

@gavi
Last active July 9, 2020 13:43
Show Gist options
  • Save gavi/66c66a427b715bc0f8ac015cf73c6d40 to your computer and use it in GitHub Desktop.
Save gavi/66c66a427b715bc0f8ac015cf73c6d40 to your computer and use it in GitHub Desktop.
A quick playground example of SwiftUI with Mapkit. UIViewRepresentable is used
import MapKit
import SwiftUI
import PlaygroundSupport
struct ContentView:View{
var body:some View{
VStack{
Text("Hello, World")
MapView()
}
}
}
final class MapView:UIViewRepresentable{
func makeUIView(context: Context) -> MKMapView{
let view = MKMapView(frame: CGRect.zero)
return view
}
func updateUIView(_ uiView: MKMapView, context: Context) {
}
}
let contentView = ContentView()
PlaygroundPage.current.setLiveView(contentView)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment