OrderedDictionary

public struct OrderedDictionary<Key, Value> : DictionaryProtocol where Key : Hashable
extension OrderedDictionary: Collection
extension OrderedDictionary: ExpressibleByDictionaryLiteral
extension OrderedDictionary: Equatable where Value: Equatable
extension OrderedDictionary: Hashable where Value: Hashable

Ordered Dictionary.

Instance Properties

  • Ordered keys.

    Declaration

    Swift

    public var keys: [Key]
  • Values.

    Declaration

    Swift

    public var unordered: [Key : Value]

Initializers

  • Create an empty OrderedDictionary

    Declaration

    Swift

    public init()
  • Creates an empty OrderedDictionary type with preallocated space for at least the specified number of elements.

    Declaration

    Swift

    public init(minimumCapacity: Int)

Subscripts

  • Declaration

    Swift

    public subscript(key: Key) -> Value? { get set }

    Return Value

    Value for the given key, if available. Otherwise, nil.

Instance Methods

  • Append value for given key.

    Declaration

    Swift

    public mutating func append(_ value: Value, key: Key)
  • Insert value for given key at index.

    Declaration

    Swift

    public mutating func insert(_ value: Value, key: Key, index: Int)
  • Append the contents of another OrderedDictionary structure.

    Declaration

    Swift

    public mutating func appendContents(of orderedDictionary: OrderedDictionary<Key, Value>)
  • Reserves the amount of memory required to store the given minimumCapacity of elements.

    Declaration

    Swift

    public mutating func reserveCapacity(_ minimumCapacity: Int)
  • Declaration

    Swift

    public func value(index: Int) -> Value?

    Return Value

    The value at the given index.

Collection

    • Index after given index i.

    Declaration

    Swift

    public func index(after i: Int) -> Int
  • Start index.

    Declaration

    Swift

    public var startIndex: Int { get }
  • End index.

    Declaration

    Swift

    public var endIndex: Int { get }
  • Declaration

    Swift

    public subscript(index: Int) -> (Key, Value) { get }

    Return Value

    Element at the given index.

ExpressibleByDictionaryLiteral

  • Create an OrderedDictionary with a DictionaryLiteral.

    Declaration

    Swift

    public init(dictionaryLiteral elements: (Key, Value)...)