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

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


init?(rawValue:) Required

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


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.


var rawValue: Self.RawValue { get }