Post not yet marked as solved
Will this version of MapKit allow you to tap on a map and get the location to say play a pin there?
Thanks
Post not yet marked as solved
This code produces error "Publishing changes from within view updates is not allowed, this will cause undefined behavior."
when displaying Annotation, but not when displaying Marker. I'd like to understand why and so far have not figured it out.
import SwiftUI
import MapKit
struct ContentView: View {
@StateObject var annotationViewModel = AnnotationViewModel()
@State private var position: MapCameraPosition = .automatic
var body: some View {
Map(position: $position) {
ForEach(annotationViewModel.annotations, id: \.self) { result in
// Marker(result.title!, systemImage: "t.circle.fill", coordinate: result.coordinate)
Annotation(result.title!, coordinate: result.coordinate) {
Image(systemName: "t.circle.fill")
}
}
}
.mapStyle(.standard(elevation: .flat))
}
}
class MyAnnotation: NSObject, Identifiable {
let id: UUID
let title: String?
let coordinate: CLLocationCoordinate2D
init(id: UUID, title: String?, coordinate: CLLocationCoordinate2D) {
self.id = id
self.title = title
self.coordinate = coordinate
}
}
extension CLLocationCoordinate2D {
static let ch = CLLocationCoordinate2D(latitude: 43.653734011477184, longitude: -79.38415146943686)
}
class AnnotationViewModel: NSObject, ObservableObject {
@Published var annotations = [
MyAnnotation(id: UUID(), title: "CITY HALL", coordinate: .ch),
]
}
Subject says it all: is or will there be a way to download offline maps programmatically?
Post not yet marked as solved
is it possible, to allow the user updating the marker position like with the MKMarkerAnnotationView.isDraggable attribute available in a MkMapView?
Post not yet marked as solved
Hi,
Tile overlays, the method to use other sources than Apple's maps, are not covered (yet).
What would be the best way of implementing them now, in SwiftUI with the new MapKit?
Thanks
-Werner
Post not yet marked as solved
Map(position: $position, selection: $selectedResult) { MapPolyline(coordinates: track).stroke(.blue, lineWidth: 5)
}
When the @State track: [CLLocationCoordinates] is growing with new data (new coordinates appended) how can we reach that Map and MapPolyline is automatically refreshed?
Post not yet marked as solved
Does visionOS support mapkit?
I really would like to avoid installing any beta versions, when can i expect the SDK to be available and deployed for us to use?
Post not yet marked as solved
Hi,
Can someone explain how the Map() position should work?
struct ContentView: View {
@State private var position: MapCameraPosition = .userLocation(followsHeading: true, fallback: .automatic)
var body: some View {
Map(position: $position) {
UserAnnotation()
}
}
}
I was expecting the map to zoom in to users location but it shows the map zoomed out to the max instead. Location is authorized. I've also added the location button.
.mapControls {
MapUserLocationButton()
}
Pressing it zooms in to the user's location without issues.
Thanks!
Where is the source code for Meet MapKit for SwiftUI video ?
Post not yet marked as solved
Have a map. I have two pins. i have two buttons. When one button is pressed it goes to first pin. When second button is pressed it goes to second pin. The problem is if I move the map at all then press second button the first button vanishes and the map hasn’t moved - wonder if this is a bug. I can surely put the code
Post not yet marked as solved
The new Mapkit for SwiftUI improvements are much welcomed. Are custom map callouts available? Thank you.
Post not yet marked as solved
The new Map builder SwiftUI is awesome. Does it support cluster annotations? I have opened FB12244017. Thank you very much!