Post

Replies

Boosts

Views

Activity

MapProxy conversion from screen to coords is wrong on macOS
Try the following code on macOS, and you'll see the marker is added in the wrong place, as the conversion from screen coordinates to map coordinates doesn't work correctly. The screenCoord value is correct, but reader.convert(screenCoord, from: .local) offsets the resulting coordinate by the height of the content above the map, despite the .local parameter. struct TestMapView: View { @State var placeAPin = false @State var pinLocation :CLLocationCoordinate2D? = nil @State private var cameraProsition: MapCameraPosition = .camera( MapCamera( centerCoordinate: .denver, distance: 3729, heading: 92, pitch: 70 ) ) var body: some View { VStack { Text("This is a bug demo.") Text("If there are other views above the map, the MapProxy doesn't convert the coordinates correctly.") MapReader { reader in Map( position: $cameraProsition, interactionModes: .all ) { if let pl = pinLocation { Marker("(\(pl.latitude), \(pl.longitude))", coordinate: pl) } } .onTapGesture(perform: { screenCoord in pinLocation = reader.convert(screenCoord, from: .local) placeAPin = false if let pinLocation { print("tap: screen \(screenCoord), location \(pinLocation)") } }) .mapControls{ MapCompass() MapScaleView() MapPitchToggle() } .mapStyle(.standard(elevation: .automatic)) } } } } extension CLLocationCoordinate2D { static var denver = CLLocationCoordinate2D(latitude: 39.742043, longitude: -104.991531) } (FB13135770)
4
0
989
Sep ’23
MapUserLocationButton inexplicably requires location permissions
When I add a MapUserLocationButton to the SwiftUI Map, it does not work unless I have previously requested location access. Since this is a SwiftUI control that the user explicitly clicks to display their location in the map, I don’t think the app should need to request location access. The user is expressing an explicit intent by clicking the button. Maybe the button should display the request prompt automatically if not already granted when the control is used, rather than silently failing? In my app, I had previously requested permission, and was pleased to be able to remove that when migrating to the built-in button... or so I thought! (FB13134130)
0
1
606
Sep ’23
iCloud document sharing open in app on macOS
We have a macOS app, SheetPlanner, that supports sharing a document with other people for collaboration, via iCloud Drive. When someone shares a document in Apple Pages, e.g. via email, and someone else clicks the link to open the document, the panel offers to open the document "in Pages", and opens the document directly in the app: But when we do the same with a SheetPlanner document, it is missing the "in SheetPlanner" part, and instead displays the document in the Finder: What are we missing? How can we get the iCloud sharing mechanism to offer to open in the app? Here's a video that demonstrates this: https://dropbox.com/s/bh9ipmn3h9ucpfc/Pages%20V%20SheetPlanner%20Sharing%20Behaviour.mov?dl=0
0
0
765
Apr ’22