I’m trying Swift Apprentice chapter 8, CafeHunter-Starter. When open in Xcode 9.4, gives below error:
"… contains source code developed with Swift 2.x. Xcode 9 does not support building or migrating Swift 2.x targets.
Use Xcode 8.x to migrate the code to Swift 3.
Thanks in advance.
Unfortunately the only way I know of how to solve this is to download Xcode 8.3.3 from apple’s download page. Make sure you rename Xcode before installing (so you can have 9.4 and 8.3.3 on your computer at the same time)… then open the project, convert to the latest version of swift, then open it in 9.4 again:
You’ll need to log into your account, but yeah.
@rahu Thanks very much for your question!
I did some digging around, and unfortunately @personalcompass’s advice is the only real option out there, and I do apologize. I did find this link which essentially suggested the same thing.
I hope this helps!
All the best!
Hope you have fixed this issue. Yes apple have not made it easy to migrate an older source, they support just the last version. To share the pain for context, we had projects in Swift 1.1, 2.1 and 3.x that we had to abandon or re-write due to these changes and supporting something that was already in production.
Sample code should be easy to convert, but in many cases not everything gets updated and you will still need to manually fix a couple of things. As an Author myself, I know the pain of upgrading sample code it can unfortunately lag, but I am sure as soon as there is a refresh (new version of the book), the code should be updated.
This topic was automatically closed after 166 days. New replies are no longer allowed.