RawRepresentable
extension RawRepresentable
-
Factory method that tries to create a new instance for a
Type
that isRawRepresentable
and throws anUnsupportedRawValue
when theType
‘sinit?(rawValue:)
returns nil.Throws
whenever theType
does not supportvalue
as rawValueDeclaration
Swift
static func decode(from value: Self.RawValue) throws -> Self
Parameters
value
the raw value for the new instance
Return Value
a new instance with rawValue
value