Meet MapKit for SwiftUI


Expanded swiftUI API

Use MapKit to your app,

This is a code along class.  

Adding a marker to a Map, is like adding a view to al list.  

Markers are used to display content on a map.

Annotation allows your to provide a view at a specific location

Using the content builder closure allows you to put things on the map.

You can use .mapStyle to change the display of the map,   .standard map is like a paper map.  Adding elevation: .realistic the map will be able to handle terrain information.

Search results can be shown on the map. 

MKLocalSerach will find places near the coordinates you provide.

Map Items can use automatically color and style results, you can override and provide your own image or even three letters of text.

What the map shows is controlled by a .MapCamera (explicit) or a .MapCameraPosition (dynamic)

If you provide a binding to the position state, MapKit will update based on the user’s position.

.onMapCameraChange informs us when there is a change to what is made visible.

Look around Preview pulls in a scene based on MKLookARoundSceneRequest which will return a look around

MapPolyline can be used to show a driving route.

MapPolygon and MapCircle can be used to mark areas on the map.

MapUserLocationButton() will show where the user is

MapCompass() will show the compass on the map

MapScaleView() will show on the screen to show zoom level.

If you use MapControls Modifier they will be placed in default places.  But since they just views, you can place them where you want them in your own position of the app.