Latest 0.0.1
Homepage https://github.com/cemolcay/DictUtils
License MIT
Platforms ios 8.0, osx 10.10, watchos 2.0, tvos 9.0, requires ARC
Authors

Adds bunch of extensions and operators that would make work with Dicitonaries easier. If you are working with JSON and don’t want to use dependencies like SwiftyJSON and keep everything native, you can peacefully grab that little helper.

Requirements

  • Xcode 10+
  • Swift 4.0+
  • iOS 8.0+
  • tvOS 9.0+
  • macOS 10.10+
  • watchOS 2.0+

Install


Manually

  • Copy the DictUtils.swift file into your codebase.

Cocoapods

pod 'DictUtils'

Extensions

  • + and += operators

    • Merges two dictionaries without hassle.
  • Typed, chainable subscripts
    • Get int, string, bool, double, [String: Any] and their array types.
let index = dataSource[int: "index"]
let name = dataSource[string: "name"]
let zipCode = dataSource[dict: "users"]?[0][dict: "address"]?[string: "zip"]
  • Initialize a dictionary from a JSON string.
let dict = [String: Any](json: response.string)
  • Get pretty printed string with dataSource.prettify().

Latest podspec

{
    "name": "DictUtils",
    "version": "0.0.1",
    "summary": "Adds bunch of extensions and operators that would make work with Dicitonaries easier.",
    "description": "DictUtilsn====nnAdds bunch of extensions and operators that would make work with Dicitonaries easier. If you are working with JSON and don't want to use dependencies like SwiftyJSON and keep everything native, you can peacefully grab that little helper.nnRequirementsn----nn* Xcode 10+n* Swift 4.0+n* iOS 8.0+n* tvOS 9.0+n* macOS 10.10+n* watchOS 2.0+nnInstalln----nn#### Manuallynn* Copy the `DictUtils.swift` file into your codebase.nn#### Cocoapodsnn```npod 'DictUtils'n```nnExtensionsn-----nn* `+` and `+=` operatorsn*   Merges two dictionaries without hassle.nn* Typed, chainable subscriptsn*   Get `int`, `string`, `bool`, `double`, `[String: Any]` and their array types.nn``` swiftnlet index = dataSource[int: "index"]nlet name = dataSource[string: "name"]nlet zipCode = dataSource[dict: "users"]?[0][dict: "address"]?[string: "zip"]n```nn* Initialize a dictionary from a JSON string.nn```nlet dict = [String: Any](json: response.string)n```nn* Get pretty printed string with `dataSource.prettify()`.",
    "homepage": "https://github.com/cemolcay/DictUtils",
    "license": "MIT",
    "authors": {
        "Cem Olcay": "[email protected]"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/cemolcay/DictUtils.git",
        "tag": "0.0.1"
    },
    "source_files": "DictUtils/Source/DictUtils.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This