Peter-Schorn / SpotifyAPI

A Swift library for the Spotify web API. Supports all endpoints.
https://peter-schorn.github.io/SpotifyAPI/documentation/spotifywebapi
MIT License
251 stars 32 forks source link

Invalid redeclaration of synthesized implementation for protocol requirement 'allCases' #13

Closed gbesler closed 3 years ago

gbesler commented 3 years ago

Hello @Peter-Schorn , thanks for this great library. However, I cannot build it in my project. I have tried from version 1.1.2 to 1.5.1 and I get same error:

Invalid redeclaration of synthesized implementation for protocol requirement 'allCases'

XCode returns several errors and I am attaching them:

Screen Shot 2021-04-16 at 10 07 33 Screen Shot 2021-04-16 at 10 09 46

I have no idea how to fix those errors. Could you please guide?

Peter-Schorn commented 3 years ago

The library builds just fine for me. Try building it by itself without attaching it to any project. If it builds fine by itself, then link me to the full project that you are using it in. Furthermore, please tell me about the swift version and platform that you are building on.

Peter-Schorn commented 3 years ago

Ok, I think I know exactly why you are unable to build the library: You're using a version of swift prior to 5.2, which was when SE-0249 was introduced, which allows you to use key path literals as functions. Is there a reason why you haven't updated yet?

jminutaglio commented 3 years ago

Same issue:

Screen Shot 2021-04-26 at 4 11 13 PM

This was introduced w/ Xcode Version 12.5 (12E262); same code complied w/out issue in the previous Xcode version.

(Swift is 5.2)

Any ideas?

Peter-Schorn commented 3 years ago

You're using Swift 5.2 with Xcode 12.5? Why? Swift 5.3.2, was released along with Xcode 12.3.

Peter-Schorn commented 3 years ago

Xcode 12.5 was released along with swift 5.4, which I'm about to update to.

Peter-Schorn commented 3 years ago

You can depend on the swift-tools-5-1 branch if you want, which supports Swift 5.1 and 5.2, unlike master. However, I will make no guarantees about keeping it up to date with master. Is there a reason why you're still using Swift 5.2?

jminutaglio commented 3 years ago

apologies, typo: Swift 5.x.

LMK if you have the same experience w/ Xcode 12.5

Peter-Schorn commented 3 years ago

apologies, typo: Swift 5.x.

So then which minor version are you using? It's important. master does not compile on versions of swift before 5.2, because this was when Key Path Expressions as Functions was introduced.

Are you able to build the swift-tools-5-1 branch?

jminutaglio commented 3 years ago

The Xcode 12.4/Swift version (on which the library complied w/out issue):

Screen Shot 2021-04-26 at 4 50 10 PM

The Xcode 12.5 version (on which the library has the compiler errors above):

Screen Shot 2021-04-26 at 4 50 13 PM

I haven't tried the swift-tools-5-1 branch.

Peter-Schorn commented 3 years ago

So it's not compiling on swift 5.4? I'll have to look into that. I'm still waiting for the Xcode update to complete.

jminutaglio commented 3 years ago

Correct. Upon update to 5.4/Xcode 12.5 the errors showed during a build. There was no change to the code, just an Xcode update.

Peter-Schorn commented 3 years ago

Ok I figured it out: It's a bug. See here.

Peter-Schorn commented 3 years ago

I've just pushed a commit that fixes this issue.

jminutaglio commented 3 years ago

TY for addressing so quickly. You are appreciated!

:)