2020-04-02a few seconds read (About 41 words)How to decode with default case for enum in SwiftIssue #634 12345678910public enum Weapon: String, Decodable { case sword = "SWORD" case gun = "GUN" case unknown = "UNKNOWN" public init(from decoder: Decoder) throws { let rawValue = try decoder.singleValueContainer().decode(String.self) self = Weapon(rawValue: rawValue) ?? .unknown }}#swift