r/iOSProgramming • u/mkrupinski13 • Jun 04 '14
Apple Wants Devs To Love Swift, Its Shiny New Language—But There's A Catch
http://readwrite.com/2014/06/04/apple-swift-programming-language-wwdc#awesm=~oGf2uWdKZsfRbt12
u/stcredzero Jun 04 '14
This entire article seems to be written by someone who doesn't understand the implications of Swift not only natively targeting the Obj-C runtime, but existing entirely to target it. The comparison with RubyMotion breaks down, because Ruby is a foreign ecosystem with a somewhat foreign conception of Object Oriented. (Only somewhat. Both of them owe a lot to Smalltalk. But the long absence of Blocks from Obj-C combined with class and header files changed the flavor of Obj-C's OO.)
Basically, Swift is facing an entirely different set of obstacles. Instead of trying to target Rubyists and make them happy on the Obj-C runtime, they are targeting Obj-C programmers and trying to make them happy there.
2
Jun 05 '14
Exactly. You get articles like this when a blogger learns programming at a bootcamp for 3 months and start analyzing developer platforms.
1
Jun 06 '14
I think the bigger miss is not understanding the new language features, especially the functional ones. The type system and pattern matching comes to mind. It's silly for the article to call it a 1st party RubyMotion analog.
0
u/stcredzero Jun 06 '14
Agreed. Those two features are actually a bigger deal than anything else! (Improved performance is nice, though. And better block syntax is quite important too.)
2
Jun 06 '14
Speed improvements aren't a given yet. I've seen some code that can perform a lot worse (certain loops using the generators and such). There are some very neat tricks that the compiler can pull though (specializing generics, etc.), but does make debugging retail builds more of a pain.
9
u/Legolas-the-elf Jun 04 '14
Essentially, Apple is wagering that Swift will save enough time and effort that it might encourage more developers try their hand at building iOS apps. So Apple would clearly like to see developers learn and adopt Swift—well, swiftly.
I see no indication that this is the case. Even if Swift were as difficult for newbies to learn as Objective-C, it would still be a massive step forward.
The trick here is that this kind of interoperability basically has to work perfectly for Swift to succeed. If it doesn't, then developers will still need to tinker with Objective-C to make their apps work
Firstly, this is not true. For instance, Objective-C itself is a relatively thin layer on top of C, and plenty of Apple's APIs require developers to drop down to C. Yet Objective-C is still a success.
Secondly, Apple have a track record of something very close to perfection in this regard. For instance, when Apple introduced ARC, it interoperated with non-ARC seamlessly in the general case, with only a few minor areas where some developers needed to pay attention to the bridging. Likewise with things like toll-free bridging.
In some ways Swift is like an official Apple version of the RubyMotion experiment. It’s an easier language that interfaces directly with the Objective-C libraries and Cocoa and Cocoa Touch frameworks. But that means many—possibly all—Swift users are still going to need to know Objective-C.
I don't think that's likely. Apple are clearly positioning Swift to be a complete replacement for Objective-C for the average developer, and it seems very achievable to me.
5
u/arrowoftime Jun 04 '14
This piece is built from the idea that Swift is built on top of Objective C. In the short term, it's true that many of the frameworks and libraries are written in Objective C, and one could argue this. However, they are both compiled languages, and it seems Apple fully intends to phase out Objective C in the long term.
The real problem, alluded to in the article, is that so many resources will continue to exemplify interacting with framework api's in Objective C syntax. A complete lack of familiarity with Objective C will be hard for new developers, especially those without a background in C/C++, to read old stack overflow threads and tutorials. However, this problem will quickly fade.
1
Jun 05 '14
Pure fluff article.
It's based entirely on assumption. Not a single concrete example of something you can't do in Swift and would have to drop down to Objective-C for.
4
u/mkrupinski13 Jun 04 '14
How important will it be to learn Objective-C if Swift takes off?