Errors Users Can Read
"The operation couldn't be completed" helps no one
When a request fails, Swift gives you an error β but URLError messages read like legal disclaimers. If someone signs up with an email that's taken, they deserve "That email is already registered. Try logging in instead." β not error code -1011.
The fix is a typed error: your own enum of the failures your app actually cares about. Any type can be thrown as long as it conforms to Error (an empty marker protocol). Add LocalizedError on top β a protocol with one interesting requirement, errorDescription: String? β and every error carries a human-readable sentence that SwiftUI alerts and labels can show directly via error.localizedDescription.
You already know the last ingredient: an enum case can carry an associated value, so serverError(String) carries the message itself.