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


Although this has public 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


    var rawValue: String { get }
  • Declaration


    init?(rawValue: String)