Dictionary

extension Dictionary
extension Dictionary where Value: Equatable
  • Assigns the value computed by v to k if k is not already present in the dictionary.

    Declaration

    Swift

    @discardableResult
    public mutating func assignValueIfAbsent(forKey k: Key, _ v: @autoclosure () -> Value) -> Bool

Available where Value: Equatable

  • Removes the key/value pairs in self that are not also in other.

    Declaration

    Swift

    public mutating func formIntersection(_ other: `Self`)
  • Returns a new dictionary containing the key/value pairs common to self and other.

    Declaration

    Swift

    public func intersection(_ other: `Self`) -> Dictionary<Key, Value>