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 a 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: Self.RawValue)

Instance Variables

var rawValue: Self.RawValue Required

The corresponding value of the "raw" type.

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

Declaration

var rawValue: Self.RawValue { get }