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)
}
	}
}
Post
Replies
Boosts
Views
Activity
I noticed that you are referring Swift Playgrounds as .playground only files, not .playground or .playgroundbook files. Now as the Swift Playground app on both Mac and iPad generates .playgroundbook files by default (with module support), can we submit .playgroundbook as well?