It was tempting to do some refactoring at the same time as the conversion, but this usually created more messes. (I was ready to buy one a few weeks into this, but I'm holding out for a 16" with Apple Silicon.) I have a three-year old MacBook Pro and could have benefitted from a faster computer. Sometimes the interface was so slow I had to copy code into BBEdit, work on it there for a while, then copy it back into Xcode. Often the compiler just gave up and didn't show me anything. Xcode really bogged down after converting a large file and trying to show all the new errors that generated. Even so, I think the project would have been impractical without these tools. If you don't mind potentially adopting a new style guide, that will be a big chunk of work you won't have to do. I spent around a quarter of the project time stubbornly putting my code back to the way I wrote it. They also both stripped out the explicit use of self (or this) when referring to class variables, which I consistently do in all my code. For example, they both stripped out parentheses from complex conditional expressions that weren't strictly necessary but that made the expressions more readable. More annoyingly, both imposed some coding style and formatting changes that I didn't agree with. Both of these tools required some manual cleanup after converting. I used Swiftify's Advanced Project Converter (but just converted a few files at a time as they recommend), which is similar to the Java to Kotlin converter built into Android Studio. this all required rework and sometimes wasn't evident until testing revealed new bugs. Dictionaries aren't objects, properties aren't atomic, similar types like Float and CGFloat aren't interchangeable. I think Swift is simply more different from Obj-C than Kotlin is from Java, in syntax and functionality. Xcode does more enforcing of Swift style, like renaming my functions, but that didn't work consistently and required a lot of manual cleanup. I wrote more about this on StackOverflow, but this Apple site won't let me link to that (?!?!). I was spending so much time trying to get Obj-C and Swift code to work together that I finally gave up and didn't even try to build again until all the files were converted. Obj-C/Swift interoperability is not nearly as smooth as Java/Kotlin interoperability. The Objective-C to Swift conversion took twice as many hours as the Java to Kotlin conversion. I previously converted the Android version of the same app from Java to Kotlin, so I have that experience for comparison. So I can partially answer my own question.įirst, it was harder than I expected. I went ahead with this project and am at the beta testing stage now. Simply retyping thousands of lines of code with a new syntax can be exhausting, though. I'm expecting this to be easier than that since most of the classes and frameworks are the same, but with slightly different names and a very different syntax. What made you decide to go for it, was it easier or harder than you expected, are you happy with the results?īTW, I ported some of my apps to Android back in 2013, so I have some sense of the scale of the project. My question is more general: if you migrated a large project, I'd be curious to hear something about your overall experience. I've found some good tips for managing the migration, including this article: This confirms that the time is right to make this investment. For example, new framework documentation only includes Swift code samples, while older documentation includes both. At the same time, I've been noticing a stronger bias toward Swift in Apple's documentation and code samples. Then this year, the economic slowdown from COVID has given me more time, and I've decided to tackle it this fall. I've kept an eye on Swift and started some new projects in Swift, but the task of rewriting my existing apps has been too big to make a priority. I've been publishing iOS apps since 2009, a couple of which have grown quite large in that time (over 200 classes in the largest), all in the original Objective-C language.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |