Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does =>? actually work as intended? #70

Closed
irace opened this issue Jan 22, 2016 · 4 comments
Closed

Does =>? actually work as intended? #70

irace opened this issue Jan 22, 2016 · 4 comments

Comments

@irace
Copy link

irace commented Jan 22, 2016

I can’t figure out for the life of me why the following does not work:

struct Foo: Decodable {
    let bar: String?

    static func decode(object: AnyObject) throws -> Foo {
        return try Foo(bar: object =>? "bar")
    }
}

When parsing the following JSON:

{
  "bar": null
}

I would expect decode to not throw, and instead return Foo(bar: nil). What happens instead, is MissingKeyError(key: "bar").

Anviking added a commit that referenced this issue Jan 22, 2016
@Anviking
Copy link
Owner

Oops, definitely not intended. Should work now though, will bump the version after a double checking a few things.

@irace
Copy link
Author

irace commented Jan 22, 2016

Thanks!

@Anviking
Copy link
Owner

Thanks for reporting! On cocoa pods now.

@irace
Copy link
Author

irace commented Jan 23, 2016

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants