To solve this error:
Instance method 'onChange(of:perform:)' requires that 'MKCoordinateRegion' conform to 'Equatable'
you need to do conform 'MKCoordinateRegion' to 'Equatable' as it the error suggests. You can do it like eg. this:
import MapKit
extension MKCoordinateRegion: Equatable {
public static func == (lhs: MKCoordinateRegion, rhs: MKCoordinateRegion) -> Bool {
if lhs.center.latitude == rhs.center.latitude && lhs.span.latitudeDelta == rhs.span.latitudeDelta && lhs.span.longitudeDelta == rhs.span.longitudeDelta {
return true
} else {
return false
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: