What's new in MapKit

RSS for tag

Discuss the WWDC22 Session What's new in MapKit

Posts under wwdc2022-10035 tag

3 Posts
Sort by:
Post not yet marked as solved
0 Replies
43 Views
I'm messing about with the new Look Around APIs in iOS 16, and can't seem to find a way to do a few things: Hide the current location label that shows up at the bottom of the Look Around view Go straight into the Look Around view rather than having to tap into it with the button Overlay a view on top of the Look Around view when panning/movement is active (the view seems to take highest priority and I cannot override it) Get it running on MacOS (as an iPad app) struct LookAroundView: UIViewControllerRepresentable { func makeUIViewController(context: Context) -> some UIViewController { let viewController = MKLookAroundViewController() viewController.badgePosition = .topLeading viewController.isNavigationEnabled = true viewController.pointOfInterestFilter = .excludingAll viewController.showsRoadLabels = false viewController.title = "Round 1" let location = CLLocationCoordinate2D( latitude: 37.80770, longitude: -122.47207 ) let sceneRequest = MKLookAroundSceneRequest(coordinate: location) Task { do { viewController.scene = try await sceneRequest.scene } catch { viewController.scene = nil } } return viewController } func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { } }
Posted Last updated
.
Post not yet marked as solved
3 Replies
99 Views
I used Xcode 14 Beta 2. It worked fine on Xcode 13. If you set it to 3000m as shown below, it will work without problems. Below is the sample code. import SwiftUI import MapKit enum MapType {   case standard   case satellite   case hybrid   case satelliteFlyover   case hybridFlyover   case mutedStandard } struct MapView: UIViewRepresentable {   let searchKey: String       let mapType: MapType   func makeUIView(context: Context) -> MKMapView {     return MKMapView()   }       func updateUIView(_ uiView: MKMapView, context: Context) {     switch mapType {     case .standard:       uiView.preferredConfiguration = MKStandardMapConfiguration(elevationStyle: .flat)             case .satellite:       uiView.preferredConfiguration = MKImageryMapConfiguration()     case .hybrid:       uiView.preferredConfiguration = MKHybridMapConfiguration()     case .satelliteFlyover:       uiView.preferredConfiguration = MKImageryMapConfiguration(elevationStyle: .realistic)     case .hybridFlyover:       uiView.preferredConfiguration = MKHybridMapConfiguration(elevationStyle: .realistic)     case .mutedStandard:       uiView.preferredConfiguration = MKStandardMapConfiguration(emphasisStyle: .muted)     }     let geocoder = CLGeocoder()           geocoder.geocodeAddressString(searchKey) { placemarks, error in       if let placemarks,         let firstPlaceMark = placemarks.first ,         let location = firstPlaceMark.location {                   let targetCoordinate = location.coordinate                   print(targetCoordinate)                   let pin = MKPointAnnotation()                   pin.coordinate = targetCoordinate                   pin.title = searchKey         uiView.addAnnotation(pin)         uiView.region = MKCoordinateRegion(center: targetCoordinate,                           latitudinalMeters: 3000.0,                           longitudinalMeters: 3000.0)       }     }   } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
130 Views
Hi Apple MapKit team, I am a new iOS developer and recently learned SwiftUI. This WWDC is my first one. I noticed that although Apple is moving towards SwiftUI, the new features released for MapKit is still largely UIKit based. I am not very familiar with UIKit. I wondered that if MapKit team is going to mainly develop in MapKit space instead of the SwiftUI space. Cheers,
Posted
by mylaluna.
Last updated
.