Re: Important question, please?


Considering all the shortcomings of Swift that you described, why did you expend the time to rewrite such a major program in Swift? Was there a benefit offsetting the shortcomings, or was it merely a learning experience?

I have had an iOS project on the backburner for a couple of years. I thought it’d be (as you say) a good learning experience to update an app I’d already written in Objective-C into Swift as prep for starting on my iOS project. In hindsight, I should have learned the language from the ground up and saved myself a lot of pain.

I do like some parts of the language’s syntax (those parts where it’s sort of python-esque), and I do like the absence of header files and the ease with which you can “talk” to other classes. I think it’s primarily all the extra type casting that I don’t like and the constant irritation of unwrapping optionals left, right, and centre. Collection classes like Arrays and Dicts are no fun to work with, and String is no equivalent to NSString, IMO. Using all three requires more typing than doing the equivalent in Objective-C and a lot more than it would in Python. It’s frustrating to see the Python-influence in some places and not others where it would have made so much sense.

Python: len(hello_world)
Objective C: hello_world.length
AppleScript: hello_world’s length
Swift: hello_world.characters.count

I don’t doubt Swift aficionados will argue it’s just different and has many benefits I’m not aware of, and I’m inclined to agree that with more familiarity I might love it a little more and hate it a little less. However, the point would still remain, bringing this back to Brian’s scenario, that you don’t want to be learning Swift by trying to rewrite something as complex as his project, especially not when the motivation is only speed of execution. Swift won’t help with that. Reducing the AppleScript calls wherever possible will though, and I believe he can do that with much less brain hurt in Objective-C - a language he’s already partially familiar with - than in Swift.



Join to automatically receive all group messages.