robb / Cartography

A declarative Auto Layout DSL for Swift :iphone::triangular_ruler:
Other
7.34k stars 525 forks source link

Invalid Redeclaration of ~ operator #276

Open axandreo opened 6 years ago

axandreo commented 6 years ago

I install Cartography, and then try to build my project. However I could not build because Xcode considered the operator overloads of ~ to be an invalid redeclaration.

I forked and built Cartography to see if the compile error would appear in the Cartography workspace but it didn't. For some reason Xcode doesn't allow the operator overloads of ~ in my project. This is in Priority.swift. Any thoughts as to why?

zackshapiro commented 6 years ago

I also get this error

orta commented 6 years ago

Want to take a look at debugging this?

zackshapiro commented 6 years ago

I solved this by downgrading from 3.0 but obviously that's not the ideal solution

franciscoamado commented 6 years ago

I also got this error but it is an intermittent problem.. Downgrading to 2.1.0, running pod install --repo-update and bumping again to 3.0 seemed to fix the problem 😄 I've looked into the method definition in Priority.swift and everything looks fine ¯_(ツ)_/¯

follyxing commented 6 years ago

+1 swift 3.2

rodericj commented 6 years ago

I was able to get around this by cloning the repo, deleting one of the duplicate definitions of ~ and replacing another duplicate definition of ~ with ~~. This is not an elegant solution and isn't going into production for me. I'm definitely open to discussing a proper solution.

Swift 3.2 Xcode Version 9.1 (9B55)

corujautx commented 6 years ago

I fixed that on my fork but I want to add more things before opening a PR to 3.0.2 as I recently opened the 3.0.1 PR.

Please see discussion in #277

ajself commented 6 years ago

I was able to fix this by choosing the Pods project in the work space, selecting the Cartography target, selecting Build Settings, and changing Swift Language Version to Swift 4.0. This isn't a permanent fix but did allow me to move on in the meantime.

alexbartisro commented 6 years ago

I also have this fix, and as a workaround I went and set the pod swift version to 4.0 manually, but it's not a long term solution

corujautx commented 6 years ago

The fix I provided in my fork should work without problems for users of Swift 3.2, so you don't need to manually change that.

Please check @ https://github.com/corujautx/Cartography

huang1988519 commented 6 years ago

Versioning For Swift 3.x: Versions <= 1.1.0

For Swift 4.x: Versions >= 2.0.0