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

Compile error with optimization level 'Fast [-O]' #112

Closed
twiedow opened this issue Dec 15, 2015 · 3 comments
Closed

Compile error with optimization level 'Fast [-O]' #112

twiedow opened this issue Dec 15, 2015 · 3 comments

Comments

@twiedow
Copy link

twiedow commented Dec 15, 2015

I get a compile error for this line of code

    let tomorrow = today.add([.Day: 1])

where today is an NSDate object, but only when the optimization level is set to fast (which is the default for release builds).

SWIFT_OPTIMIZATION_LEVEL = -O

screen shot 2015-12-15 at 09 29 30

@twiedow
Copy link
Author

twiedow commented Dec 15, 2015

By the way, this is working:

    let tomorrow = today.add(days: 1)

@Hout
Copy link
Contributor

Hout commented Dec 21, 2015

Weird! Needs investigation. Thx for the issue.

@malcommac malcommac added this to the 4.0.3 milestone Sep 30, 2016
@malcommac
Copy link
Owner

It's okay with SwiftDate4.
The new function which accomplish your request is:

let tomorrow = try! Date().add(components: [.day : 1])

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

No branches or pull requests

3 participants