Is it possible to save an MKCoordinateRegion Value in @App Storage? I tried this. But it doesn't work. I got the error 'No exact matches in call to initializer' .
@AppStorage("region_key") var region = MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: 34.011_286, longitude: -116.166_868),
span: MKCoordinateSpan(latitudeDelta: 100, longitudeDelta: 100)
)
Types that get stored in
AppStorage
have to conform toRawRepresentable
.MKCoordinateRegion
doesn't do this out-of-the-box, but you can add an extension to add conformance: