IndexCodingKey

public struct IndexCodingKey : CodingKey

A special coding key represents an index in an unkeyed container

  • the index

    Declaration

    Swift

    public let intValue: Int?
  • construct a new IndexCodingKey by passing an index. This initalizer will fail, if intValue is not a valid index, i.e. is smaller than 0

    • Paramter intValue: the index. Must be larger or equal than 0, otherwise the initalizer will fail

    Declaration

    Swift

    public init?(intValue: Int)

casting to and from strings

  • will return the index as string value

    Declaration

    Swift

    public var stringValue: String { get }
  • constructs a new IndexCodingKey from the given sting, that needs to be base 10 encoded intenger representation. this initalizer used Int(_ description: String) to convert stringValue see Int(_ description: String) for mere details about which strings will succeed

    Declaration

    Swift

    public init?(stringValue string: String)