Unknowndefault <Extended × 2027>
In Swift, every switch statement must be exhaustive. While a standard default case acts as a "catch-all" and satisfies this requirement, it can hide errors if you accidentally forget to handle a new, known case. solves this by:
: It is primarily used with enums from system frameworks (like CLLocationManager.authorizationStatus() ) or Objective-C enums that aren't marked as "closed". Placement : It must be the last case in a switch statement. unknowndefault
: It cannot be merged with other cases (e.g., you cannot write case .first, @unknown default: ). Comparison: default vs @unknown default default @unknown default Catch-all Future-proofing Warning if known cases missing Yes Behavior on new cases Triggers warning to update code Common Issues What's the deal with "@unknown default" - Swift Forums In Swift, every switch statement must be exhaustive
Polski
English
Deutsch