TypeInfo

public indirect enum TypeInfo
extension TypeInfo: CustomDebugStringConvertible
extension TypeInfo: CustomStringConvertible
extension TypeInfo: Hashable
extension TypeInfo: Equatable

Main enum used to describe a decoded type.

  • Case representing a simple type, such as a String, which is not recursive.

    Two types associated with this case: top level and low level.

    Usage Example:

    String - single(String.Type, String.Type)
    URL - single(URL.Type, String.Type)
    

    Declaration

    Swift

    case single(Any.Type, Any.Type)
  • Case representing a struct or a class containing the object type as Any.Type and its nested types as an OrderedDictionary.

    Usage Example:

    struct User: Codable {
      let name: String
      let age: Int
    }
    .keyed(User.Type, ["name": .single(String.Type, String.Type), "age": .single(Int.Type, Int.Type)]
    

    Declaration

    Swift

    case keyed(Any.Type, OrderedDictionary<String, TypeInfo>)
  • Case representing a Dictionary containing the top level type of the Dictionary, the type of the key and the type of the value.

    Usage Example:

    [String: Int] -- .dynamicKeyed(Dictionary<String, Int>.Type, key: .single(String.Type, String.Type), value: .single(Int.Type, Int.Type))
    

    Declaration

    Swift

    case dynamicKeyed(Any.Type, key: TypeInfo, value: TypeInfo)
  • Case representing an Array containing the top level type of the array and its nested type.

    Usage Example:

    [String] -- .unkeyed(Array<String>.Type, .single(String.Type, String.Type))
    

    Declaration

    Swift

    case unkeyed(Any.Type, TypeInfo)
  • Case representing an Optional type containing its nested type.

    Usage Example:

    String? -- .optional(.single(String.Type, String.Type))
    

    Declaration

    Swift

    case optional(TypeInfo)
  • Case representing a cyclic type so the associated type is the top level type.

    Usage Example:

    struct User: Codable {
      let name: String
      let friends: [User]
    }
    .keyed(User.Type, ["name": .single(String.Type, String.Type), "friends": .cyclic(User.Type)]
    

    Declaration

    Swift

    case cyclic(Any.Type)
  • Case representing a type that could not be decoded.

    Declaration

    Swift

    case opaque(Any.Type)

TypeInfo

  • Declaration

    Swift

    public var debugDescription: String { get }
  • Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Declaration

    Swift

    public static func == (lhs: TypeInfo, rhs: TypeInfo) -> Bool