Swifters: I have a custom error enum: enum MyError: Error { case network(error: Error) case json(error: Error) case value(error: Error) var localizedDescription: String { switch self { case let .network(error): return error.localizedDescription case let .json(error): return error.localizedDescription case let .value(error): return error.localizedDescription } } }
However, the localizedDescription output is odd to me. When the value is treated as: Error: po error.localizedDescription "The operation couldn’t be completed. (MyApp.MyError error 1.)” LocalizedError: po (error as! LocalizedError).localizedDescription "The operation couldn’t be completed. (MyApp.MyError error 1.)” MyError: Error: po (error as! MyError).localizedDescription "JSON could not be serialized because of error:\nThe data couldn’t be read because it isn’t in the correct format." Shouldn’t my implementation of localizedDescription take precedence in all cases here? (This is Xcode 8.3b3). Jon _______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users