swift 2.3 to swift 3.0
I have a project that was started using swift 2 in xcode 7. I am now using swift 2.3 in xcode 8. When I try to migrate to pro 3 I get several errors no project. Both from the libraries and from my code. First I update my pods and then do an automatic conversion of the project. My doubts are:
In case some library can give rise to error I can unlock it and convert?
Do I have to prepare something before starting the conversation? In the articles I read about it, I did not say anything else about it.
In case you continue using swift 2.3 will you have any future problems?
The application is very large, what would be the best option?
- VIDEO_TOO_LONG_TITLE alert shown by UIImagePickerController
- iOS how to simple return back to previous presented/pushed view controller programmatically?
- iOS 5 Twitter Framework: Tweeting without user input and confirmation (modal view controller)
- SecItemAdd always returns error -34018 in Xcode 8 in iOS 10 simulator
- Present modal view controller in half size
Solutions Collect From Internet About “swift 2.3 to swift 3.0”
Honestly? Any project built with Swift since 2014 should be done with an understanding of code will break with every new version through Swift 3.X. (I’m not at all being critical, just practical.) This year, Swift 4.X is working hard to not break Swift 3.X code.
So with that starting point, here’s my thoughts:
- 1 Take a backup of a working Swift 2.X app and archive it. Backup that backup.
- 2 Accept the price that should have been known when using any version before 3.X – the conversion will be painful and time-consuming.
- 3 Wherever possible, do not use third party add ins. They can add to the complexity of migrating to the latest version.
- 4 Do consider waiting for Swift 4. I’m not recommending this at all, but saying consider the big picture. But always remember eventually you will have to port things. (The good news is Swift 3 appears stable enough to say future upgrade will not be (at least) as painful.
- 5 Consider migrating everything at once. (If you have that golden backup duplicated in several places, that makes it easier.) Yes, there are ways to migrate individual project, files, etc. from 2.X to 3.X – and 4.X (along with what is likely Xcode 9) makes things easier going forward. But only if you are starting from 3.X.
- 6 Regards to Swift 2.3… the latest version of Xcode will not compile/build Swift 2.3. Take that as a sign – someday it will no longer be accepted in the App Store. That day may be 2-3 years away (or not), but It’s almost 2 years since the promises of ABI and version compatibility were meant for Swift 3.0. BTW, only the latter happened.
Welcome to the world of a very fast evolving language!
EDIT: Regards to point #3 (avoid third party add ins where possible), I found two links expressing the issues that can come up:
Analyzing Third Party Libraries
Avoiding Third Party UI Libraries
- NSLog crashes with certain NSURL- iOS 9.2
- Safari in ios8 is scrolling screen when fixed elements get focus
- SIGABRT runtime error in xcode 6.1 (Swift)
- SKTexture and the scale property of a UIImage
- How to migrate Alamofire router class to Swift 3?
- AVAudioPlayer error loading file
- Objective-C class -> string like: -> @“NSArray”
- NSFetchedResultsControllerDelegate animating deletion on wrong indexPath
- iOS – Open an app with a URL Scheme from Chrome
- End Date showing Wrong
- Examples of Delegates in Swift
- Wrong remote data when enableLocalDatastore with Parse
- PHAsset to UIImage
- Adding iOS UITableView HeaderView (not section header)
- Segue crashes my program. Has something to do with my NavigationController and my TabBarViewController