JSONUtilities icon indicating copy to clipboard operation
JSONUtilities copied to clipboard

Move to generic subscripts in Swift 4

Open lucianomarisi opened this issue 7 years ago • 2 comments

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")

lucianomarisi avatar May 14 '17 11:05 lucianomarisi

Unfortunately subscripts can't throw yet :/

Jon889 avatar Dec 10 '17 19:12 Jon889

That's a shame, I was hoping this feature would be introduced Swift 4, maybe next year.

lucianomarisi avatar Dec 11 '17 13:12 lucianomarisi