Updated Xcode 8 + Swift 3, TOTAL meltdown

Hello.

I’m a happy, but casual iOS app developer. Lets say I spend about 5 hrs per month coding on some apps.
I upgraded my iphone to IOS 10 and therefore I needed xcode 8 in order to deploy to it.

After xcode 8 + swift 3 upgrade, it wanted to “convert” my project.

Now, I have SERIOUS issues:

  • About 2000(!) compile errors
  • My carthage (which honestly never worked better than ‘ok’, does not work anymore, I guess that one needs update too?)
  • Since carthage is dead, all my packages are out of date = more errors
  • I had to move to a new Alomofire because of Swift 3 = half of my alamofire-calls does not work anymore…

Question:
Is it supposed to be this hard? Am I doing something wrong?
It seems like the best way forward now is to just create a new xcode project, get the correct/current swift 3 version of all my dependencies (e.g Alamofire), and migrate my old app there?

I guess this it the “price” one have to pay with a young langugage like Swift. I had the exact same problem when moving from swift 1 to swift 2. And now again with swift 3…

You’re not doing anything wrong yet. Swift 3 has a lot of breaking changes. The migration tools are good but not perfect, and that naturally complicates thing with third-party code as you have to know that’s compatible with Swift 3 as well.

I’ve just spent a day updating a relatively young project, along the way having to disconnect a Cocoapod which seemingly hasn’t been updated for Swift 3 yet. I don’t know if Carthage packages would work the same way. Deleting the project’s derived data was a significant step to avoiding compile errors (as the derived data was created using the previous Xcode and Swift 2). Alamofire is one of the good projects which is well documented with a migration guide.

Thanks for your input!

What I finally did:

  1. Created a new project.
  2. Added my third-party-addons as git submodules, so much easier:
    2.1) Add & checkout submodule
    2.2) Add the third party “xcodeproj” to my project
    2.3) Add “Embedded binary” for my target
  3. Moved my code, file by file
  4. As an added bonus, I did some refactoring & storyboard cleanup/improvements

Alamofire actually was a nice improvement. They finally added good support for authenticating with tokens & support for re-queueing failed requests due to 401 (unauthorized).

I actually asked them for that almost 2 years ago, without luck, and ended up writing my own implementation :slight_smile:
But if feels nice that they have fixed it now since I never bothered to read up about thread safety and such in Swift.
Half of their implementation uses stuff I have never seen :stuck_out_tongue:

But for other third party tools, several of them has not been migrated to swift 3.0.
So I had to replace them with other libraries.
http://awesomeios.com/ was a good place to find new ones!

Conclusion:
Yeah, it was worth the around 4 hrs of migration (including changing not updated thirdparty tools), but it’s always boring to use precious coding-time to fix something due to Framework/Swift-changes instead of building a nice new feature :stuck_out_tongue: