RawRepresentable

protocol RawRepresentable

A type that can be converted to an associated "raw" type, then converted back to produce an instance equivalent to the original.

Inheritance View Protocol Hierarchy →
Associated Types
RawValue

The "raw" type that can be used to represent all values of Self.

Every distinct value of self has a corresponding unique value of RawValue, but RawValue may have representations that do not correspond to an value of Self.

Import import Swift

Initializers

init?(rawValue:) Required

Convert from a value of RawValue, yielding nil iff rawValue does not correspond to a value of Self.

Declaration

init?(rawValue: RawValue)

Instance Variables

var rawValue: RawValue Required

The corresponding value of the "raw" type.

Self(rawValue: self.rawValue)! is equivalent to self.

Declaration

var rawValue: RawValue { get }