目录
目录README.md

DictionaryNestedSubscript

A Swift Package that enable nested subscript on Dictionary.

Usage

import DictionaryNestedSubscript

let dictionary: [String: Any] = [
    "countries": [
        "japan": [
            "capital": [
                "name": "tokyo",
                "lat": "35.6895",
                "lon": "139.6917"
            ],
            "language": "japanese"
        ]
    ]
]

dictionary[jsonDict: "countries"]?[jsonDict: "japan"]?[jsonDict: "capital"]?["name"] // "tokyo"

Integration (requires Xcode 11+)

  1. from your project, Choose Xcode > File > Swift Packages > Add Package Dependency...

demo

  1. put https://github.com/vinhnx/DictionaryNestedSubscript under Choose Package Repository field

demo

  1. (optional) specify the version or branch or specific commit you want to use from the package

demo

  1. then click Next for Xcode to resolve the package.

demo

  1. Choose where to add Package framework to your app’s target

demo

  1. Profit

demo

References

Guide

Inspiration

关于
138.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号