JSONUtilities
JSONUtilities copied to clipboard
Move to generic subscripts in Swift 4
Since now generic subscripts have been introduced I think we should be aiming to move the API to them as this cleaner and simpler. For example:
let jsonDictionary: [String: Any] = ...
let value: String? = jsonDictionary[keyPath: "data.name"]
Would replace:
let jsonDictionary: [String: Any] = ...
let value: String? = jsonDictionary.json(atKeyPath: "data.name")
Unfortunately subscripts can't throw yet :/
That's a shame, I was hoping this feature would be introduced Swift 4, maybe next year.