Dictionary

struct Dictionary<Key, Value> where Key : Hashable
  • Mechanica

    Returns a Dictionary from a given JSON String.

    Declaration

    Swift

    public init?(json: String)
  • Mechanica

    Returns a JSON Data from dictionary.

    Declaration

    Swift

    public func jsonData(prettify: Bool = false) -> Data?

    Parameters

    prettify

    true to prettify data (defaults to false).

    Return Value

    optional JSON Data.

  • Mechanica

    Returns a JSON String from dictionary.

    Declaration

    Swift

    public func jsonString(prettify: Bool = false) -> String?

    Parameters

    prettify

    true to prettify string (defaults to false).

    Return Value

    optional JSON String.

  • Mechanica

    Returns true if the key exists in the dictionary.

    Declaration

    Swift

    public func hasKey(_ key: Key) -> Bool
  • Mechanica

    Removes the given kesy and theris associated values from the dictionary.

    Declaration

    Swift

    public mutating func removeAll(forKeys keys: [Key]) -> [Key : Value]?

    Parameters

    keys

    The keys to remove along with theirs associated values.

    Return Value

    The key’s associated values (if any).

  • Mechanica

    Lowercase all keys in dictionary.

    Declaration

    Swift

    public mutating func lowercaseAllKeys()