EnumPersistable
public protocol EnumPersistable : Decodable, Encodable
Protocol that represents a Codable Enum that can be persisted and easily
integrate with remote APIs since it must have a raw String value.
That means only enums without associated values can be used as model properties.
- Example:
public enum PostStatus: String, EnumPersistable {
case draft
case published
}
Warning
Although this haspublic access, it is intended for internal use and should not be used directly
by host applications. The behavior of this may change without warning.
-
Declaration
Swift
var rawValue: String { get } -
Declaration
Swift
init?(rawValue: String)
View on GitHub