3

This is my first real encounter with updating my code to a new version of iOS and a major code change such as Swift 3. I would like to get some info regarding good practice and standard proceedures in regards to these topics.

First off, should I wait until Xcode 8 has been fully released before trying to convert my code to Swift 3? It seems like as the betas go on the code-converting feature gets more intelligent and accurate. Also, is it safe to edit inside of a beta IDE?

Secondly, my application works great on iOS 9 and is functioning perfectly. However, on iOS 10 the UI elements are acting up (changing places, not updating) and freezes at a particular spot that is not apparent in iOS 9. Is this due to a change in function names that will be updated in iOS 10? Also, will some of these bugs "fix themselves" as the betas are straightened out?

Thanks for your help!

Matt Butler
  • 476
  • 6
  • 21

2 Answers2

1

The advice is largely the same as for all Xcode beta versions: Treat beta versions of Xcode (esp Swift 3) as a "sandbox" in which you can play, but don't convert production projects. Or, more accurately, feel free to convert it so you can play in your sandbox so you'll be prepared for when Swift 3 comes out of beta, but do so knowing that the current beta Swift 3 is subject to further changes. Make sure you preserve your existing production code/projects until the Xcode 8 is out of beta). Never plan on being able to open the Swift 3 project in Xcode 7.x. Keep Swift 3 code and original Swift 2.x projects completely segregated.

Re your iOS 9 app on iOS 10, I'm surprised that you're seeing problems with your iOS 9 app (esp with iOS 10 beta 7), because most of those kinks have been worked out by now. If something isn't working right, that's a bit of an edge-case, because most well written iOS 9 code works seamlessly with iOS 10. There are API changes, but an app built for iOS 9 generally runs fine on an iOS 10 device. There are very few things that would result in those sorts of visual artifacts/errors that you describe. You're having problems, you should post a new question with a MCVE illustrating the problem.

Community
  • 1
  • 1
Rob
  • 415,655
  • 72
  • 787
  • 1,044
  • Thanks for answering! This helped to clear some things up for me. However, another question would be, how do I test my app in iOS 10 (while viewing error codes and stack traces) without converting to Swift 3? – Matt Butler Aug 22 '16 at 23:35
  • You can install the app from Xcode 7 on an iOS 10 device a variety of different ways, e.g. http://stackoverflow.com/a/35044362/1271826. But, I assumed you had already done this ... how did you conclude that these UI controls were acting up on iOS 10? – Rob Aug 22 '16 at 23:52
  • I have iOS 10 beta on my iPhone in which I installed the app via Devices in Xcode – Matt Butler Aug 23 '16 at 00:02
  • After a clean install of the app, the UI labels and such are working fine. However, the app still freezes at a point in which the iOS 9 version does not. – Matt Butler Aug 23 '16 at 00:41
  • The only way to see stack traces is to let it crash and look at the crash logs via the "Devices" window. Or make a copy of the project and convert it to Swift 2.3 in Xcode 8 (less labor than the Swift 3 conversion) and then you can run it through the debugger. (You may get some informative warnings, too, when you compile it.) – Rob Aug 23 '16 at 01:03
0

Given your question I will point out some things that I encountered. I would keep a copy of the Swift 2.2 code in the original format, this may seem obvious but it's something that helped me so I'm putting it out there. One specific problem I encountered was "Thread 1: signal SIGABRT" running my converted code. I just deleted my object connections in the storyboard, in this case a UIButton object, and after conversion, reconstituted them and the error went away. I am still working on converting code so when I find something and fix it I will add to my posts. I would suggest if you get something specific when doing conversion to just ask a different question and post it. It keeps things simple.

gosborne3
  • 47
  • 1
  • 9