Anviking / Decodable

[Probably deprecated] Swift 2/3 JSON unmarshalling done (more) right
MIT License
1.04k stars 73 forks source link

Expose KeyPath.keys, make KeyPath Equatable #122

Closed JaviSoto closed 7 years ago

JaviSoto commented 7 years ago

I use this pattern to group the keys that I use in a Decodable type:

struct MyDecodableType: Decodable {
    enum Keys: KeyPath {
        case foo = "foo"
        case bar = "bar"
    }
}

I used to make those Keys enum have an associated String value, but with the switch to KeyPath, in order to be able to use KeyPath as the raw value of an enum, it needs to conform to Equatable.

JaviSoto commented 7 years ago

Thanks!

Do you mind rebasing this on top of beta6?

Anviking commented 7 years ago

beta6 should have been deleted before, master is the most up to date.