Dictionary

public extension Dictionary
  • Merge with another dictionary, existing keys in left dictionary are overridden by keys right dictionary.

    Declaration

    Swift

    mutating func merge(with another: [Key : Value])
  • Returns a new dictionary by merging right dictionary into left dictionary.

    Declaration

    Swift

    func merged(with another: [Key : Value]) -> [Key : Value]
  • Merge two dictionaries.

    Declaration

    Swift

    static func + (left: [Key : Value], right: [Key : Value]?) -> [Key : Value]

    Parameters

    left

    left dictionary

    right

    right dictionary

    Return Value

    Merged dictionary, existing keys in left dictionary is overrided by right dictionary.

  • Merge two dictionaries and left is updated.

    Declaration

    Swift

    static func += (left: inout [Key : Value], right: [Key : Value]?)

    Parameters

    left

    left dictionary

    right

    right dictionary

Random Subset

  • Returns a random subsect of the dictionary.

    Declaration

    Swift

    func randomSubset() -> [Key : Value]