Last active
July 9, 2020 13:43
-
-
Save gavi/66c66a427b715bc0f8ac015cf73c6d40 to your computer and use it in GitHub Desktop.
A quick playground example of SwiftUI with Mapkit. UIViewRepresentable is used
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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