KeyedCollection

public protocol KeyedCollection: Collection where Self.Element == (key: Key, value: Value)

A Collection type that contains keyed values.

This protocol acts as an abstraction over Dictionary for the Serializer type. It is mostly for testing purposes but you can also conform your own types if you want.

  • Key

    The type of a key for a given value.

    Declaration

    Swift

    associatedtype Key: Hashable
  • The collection type for a list of the collection’s keys.

    Declaration

    Swift

    associatedtype Keys: Collection where Keys.Element == Key
  • The type of a value.

    Declaration

    Swift

    associatedtype Value
  • The collection type for a list of the collection’s values.

    Declaration

    Swift

    associatedtype Values: Collection where Values.Element == Value
  • All the collection’s keyes.

    Declaration

    Swift

    var keys: Keys
  • All the collection’s values.

    Declaration

    Swift

    var values: Values