MapCameraPosition camera region rect item all of them are nil

@State var position : MapCameraPosition = .userLocation(fallback: .region(.defaultRegion))

Map(position: $position) {}
.onAppear {
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { timer in
print("check.position",position.camera,position.region,position.rect,position.item)
            }
}

All of the value are nil, so how do I get the current camera position??

check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil
check.position nil nil nil nil

It is always nil (even if I manually move around the Map with a finger)

Hi @Tennaaaaaaa , mmm I'm not sure about what is your question, but SwiftUI Map shows you the MapKit View and is really powerful, because you could integrate in one line of code the MapKit UIKit framework in SwiftUI. This is coherent with nil values you see, MapKit doesn't refresh position, only display a Map.

But if you want a system that tracking in real time current location of user and display it on MapKit View, you should implement an CLLocationManager and its delegates methods.

If this is the scope of your app, please check on following documentation link https://developer.apple.com/documentation/corelocation/cllocationmanager

Bye Rob

MapCameraPosition camera region rect item all of them are nil
 
 
Q