iHate Swift 2

Am I the only one who hates the big changes Apple makes this year? Why can't they make just small changes in Swift???? It's not hard to convert all my Code to Swift 2. It is IMPOSSIBLE. I get 9 errors, even if I could fix them and press the "build and run" Button I get 20 new errors. Every time. And most of them do really not make any sense. I will never ever switch to Swift 2. And if this means I can't build new Apps one day, that's ok. Even switching to Android is still better than switching from Swift 1 to Swift 2. I will not learn a completely new programming language every year. Because that's what Swift 2 is. Last year it was Swift. Now it's Swift 2. And next year? Will I have to learn Swift 3 which will also be a completely new language? No, thanks.

Answered by Jens in 46058022

I don't think the OP wants help. The post seems to be more of a statement/rant and the questions in it are probably rhetorical.

Most of the errors coming changes in the SDK and not in the language. The changes made to the language are very simple to absorb. And I believe it was well expected that this year we would have several changes (and we get only one major change), and every year it is likely that fewer changes appear according to the evolution of language.

only one change? I get thousands of different errors. Why shouldn't


var tabBarItems = self.tabBar.items as! [UITabBarItem]


be correct anymore??? It IS correct. But Xcode shows an error and doesn't let me compile it.

Why not show the error in context so we can help?

Doesn't do any good to just complain about a problem and not describe it.

It was only an example. It wouldn't help to solve this one problem because it is only one of so many.

So you expect help but you won't show the errors?

Good luck with that.

Accepted Answer

I don't think the OP wants help. The post seems to be more of a statement/rant and the questions in it are probably rhetorical.

It WAS correct, and it was needed because the old SDK could not tell Swift that all elements of the property `items` were actually UITabBarItems.

As you already know, this is the correct code in Swift 2.

        var tabBarItems = self.tabBar.items!

Don't you think it was wrong that we needed type-casting to use this sort of collections?


You'd better find another example if you want to make your opinion look reasonable.

Apple stated right up front during WWDC 2014 that there would be no guarantees of ABI or code compatibility between updates until Swift 2.0 was finalized. It was clear the rate of change for Swift would be high, because it was very young and had numerous deficiencies.


I, for one, am thrilled they have managed to make as many improvements as they did as quickly as they did.

You are indeed the only one who hates the big changes Apple makes this year. I asked. They told me that they didn't care, or they liked them.

So, SDK and ObjC language change cause this, not Swift 2.0.


So, now self.tabBar.items return [UITabBarItem] and not [AnyObject] has now the ability to tel type type the array is. The solution for this and other problem is very clear: Remove the cast.


You looked at release notes? Watched the WWDC videos? If not is better do.

I'm not sure that they specified a version or timeframe, so I think Apple's position on the issue is probably something more like "there are no guarantees of ABI or code compatibility for any future versions of Swift, until there are guarantees of ABI or code compatibility for future versions of Swift."

I dont't think so. Nobody likes upgrading thousands of lines of code every year.

Agreed. That's why I personally haven't yet converted anything to Swift. I think with 2.0 the language and tools are probably stable enough for my tastes so I will start using it for new work going forward. But I've been around long enough to understand why early adoption of anything is called the "bleeding edge".

Swift 2 will be rather stable. Not without reason it will be the basis for the open source version.

Swift 1 ist stable enough.

iHate Swift 2
 
 
Q