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

Use of BinaryFloatingPoint types with custom operators. #58

Closed
nickmshelley opened this issue Apr 11, 2018 · 7 comments
Closed

Use of BinaryFloatingPoint types with custom operators. #58

nickmshelley opened this issue Apr 11, 2018 · 7 comments

Comments

@nickmshelley
Copy link

I feel like I'm probably just missing something stupid, but the following code demonstrates a problem I'm having:

let n: Double = 44
button.heightAnchor == 44 // works
button.heightAnchor == CGFloat(n) // works
button.heightAnchor == n // Failes with "Binary operator '==' cannot be applied to operands of type 'NSLayoutDimension' and 'Double'"

I feel like it should work without wrapping it because of this operator definition: https://github.com/Raizlabs/Anchorage/blob/master/Source/Anchorage.swift#L45.

Am I doing something wrong?

@jvisenti
Copy link
Contributor

@nickmshelley Are you certain you're using the latest version of Anchorage (and also importing the module)? The snippet you provided compiles for me in Swift 4.0 / Xcode 9.2

@nickmshelley
Copy link
Author

I’m on Xcode 9.3 (Swift 4.1). Maybe it’s a new issue.

@jvisenti
Copy link
Contributor

Ahh quite possibly. @ZevEisenberg did you address anything like this in #57 ?

@ZevEisenberg
Copy link
Collaborator

Yep, @nickmshelley's code compiles on my branch. We should get an update out!

@ZevEisenberg
Copy link
Collaborator

This should be fixed as of the newly-released 4.2.2. @nickmshelley please let us know if it's working for you now, and feel free to reopen or file a new issue if it's not.

@nickmshelley
Copy link
Author

It works for us, thanks!

Funny story though... It turns out that we had copied the README line that pointed to 3.x, so we were using a year-old version. 😅 When I saw @jvisenti's question I was away from my computer and just assumed we were on the latest since we very recently added the library to the project. Sorry if my bad assumption caused any unnecessary work.

As a side note, good call on updating the readme: f43a8ee#diff-04c6e90faac2675aa89e2176d2eec7d8 :)

@jvisenti
Copy link
Contributor

@nickmshelley I noticed that Carthage documentation issue in the README by accident while we were releasing 4.2.2 😅
Glad it helped!

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

3 participants