Cartography icon indicating copy to clipboard operation
Cartography copied to clipboard

Invalid Redeclaration of ~ operator

Open axandreo opened this issue 7 years ago • 11 comments

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?

axandreo avatar Nov 10 '17 20:11 axandreo

I also get this error

zackshapiro avatar Nov 15 '17 14:11 zackshapiro

Want to take a look at debugging this?

orta avatar Nov 15 '17 16:11 orta

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

zackshapiro avatar Nov 15 '17 16:11 zackshapiro

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 ¯_(ツ)_/¯

franciscoamado avatar Nov 20 '17 11:11 franciscoamado

+1 swift 3.2

follyxing avatar Nov 20 '17 22:11 follyxing

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)

rodericj avatar Nov 21 '17 20:11 rodericj

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

corujautx avatar Nov 22 '17 16:11 corujautx

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.

ajself avatar Dec 07 '17 15:12 ajself

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

alexbartisro avatar Jan 15 '18 14:01 alexbartisro

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

corujautx avatar Jan 15 '18 15:01 corujautx

Versioning For Swift 3.x: Versions <= 1.1.0

For Swift 4.x: Versions >= 2.0.0

huang1988519 avatar Jul 16 '18 12:07 huang1988519