When I tried this, Xcode encountered an error that
Instance method 'onChange(of:perform:)' requires that 'MKCoordinateRegion' conform to 'Equatable' I ended up adding a didSet:
final class MapConfig: ObservableObject {
var region: MKCoordinateRegion = MKCoordinateRegion(...)
{
didSet {
print("changed to \(region)")
}
}
}
struct ChooseLocationView: View {
@ObservedObject var config = MapConfig()
var body: some View {
ZStack {
Map(coordinateRegion: $config.region,
interactionModes: .all,
showsUserLocation: true,
userTrackingMode: nil)
}
	}
}