Feb 27, 2025

Catch MapKit errors in Swift

You can pattern match MapKit errors in Swift.

do {
  let mapItem = ...
} catch let error is MKError {
  switch error {
  case .placemarkNotFound:
    break
  default:
    throw error
  }
}

MKError doesn't conform to Error nor does it show up in Xcode 16.2 autocomplete, but it works.