Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/20tab/depthnsdictionary

Extension to navigate a nested dictionary using separator to search nested keys in a recursive implementation
https://github.com/20tab/depthnsdictionary

Last synced: 21 days ago
JSON representation

Extension to navigate a nested dictionary using separator to search nested keys in a recursive implementation

Awesome Lists containing this project

README

        

# DepthNSDictionary

Extension to navigate a nested dictionary using separator to search nested keys in a recursive implementation

## Usage

```swift
let nested_dict: NSDictionary = ["a": 1, "b": ["c": 2, "d": 3], "e": 5]

let param_a = nested_dict.dfs(forKey: "a") as! Int
let param_d = nested_dict.dfs(forKey: "b__d") as! Int
let isNil = nested_dict.dfs(forKey: "dog__cat") // it's nil
```