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

Mapping dates #631

Closed
Dbigshooter opened this issue Oct 18, 2016 · 4 comments
Closed

Mapping dates #631

Dbigshooter opened this issue Oct 18, 2016 · 4 comments

Comments

@Dbigshooter
Copy link

Dbigshooter commented Oct 18, 2016

Hi there,

I'm trying to map a NSDate, like this:

...
var date : NSDate?
...
func mapping(map: Map) {
        date <- (map["date"], DateTransform())
    }

But it fails and I'm left with:

Binary operator '<-' cannot be applied to operands of type 'NSDate?' and '(map, DateTransform)'

@devxoul
Copy link
Contributor

devxoul commented Oct 18, 2016

@Dbigshooter, if you're using Swift 3, you should use Date instead of NSDate.

@Dbigshooter
Copy link
Author

Dbigshooter commented Oct 18, 2016

@devxoul Just changed it, compiles now, but still leaves null in my object date property.

@devxoul
Copy link
Contributor

devxoul commented Oct 19, 2016

@Dbigshooter please provide us the JSON dictionary

@Dbigshooter
Copy link
Author

Got this solved, using Date() instead of NSDate did it, thanks!

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