Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Swift looks great and finally gives a more scripting language feel to building apps for those not super skilled to learn ObjectiveC.

With that said as a developer who now develops cross platform due to market share I can't help but feel that other easier to use 3rd party app develpoment platforms are a better option. I'm talking about platforms like Unity, AIR, Corona and even HTML5 canvas based apps which allow the same code to be used for cross platform developing. The HTML5 canvas has come a long way with its hardware acceleration. Heck even webGL works well on it if mobile browsers would turn in on without a hack.

If we lived in an Apple only world then I would embrace Swift 100% but we no longer do live in an Apple only world. If you are a budding developer who only ever cares about publishing apps for Apple devices then it can be a great solution. If you want to be an app developer in general and support multiple platforms there are a lot of solutions out there for developing hardware accelerated apps without ObjectiveC.

There will always be the argument that native apps will perform better but that gap is shrinking and some of the most celebrated award winning IOS games have been built with tools such as AIR without a lick of ObjectiveC.
 
Thanks GrandM - I hadn't noticed you'd said VB rather than Visual Studio in your first post.

@int3: isn't that what Apple have done - gone with a nice to look at, easy to read and write language? The more I look at in the book the mroe I think "well, that syntax is obvious :)".

Regarding switching to programming in Swift rather than Objective C - can't we start right now? I read somewhere that you can compile Swift for iOS7 and 10.9, and since you can mix and match you could literally just change your language halfway through a project, were you so inclined. I might do just that (assuming that's true about iOS7).

At the risk of sounding like a noob here - does compiling a Swift app result in different native code (compared to compiling an Objective C app)? From the speed comparisons and fact they mentioned accepting Swift apps on the app store it sounds like it must do, but I figured using the same compiler meant it would be compiled into the same code. How's that work?
 
Last edited:
Dumb question but Swift can be used for Mac OS X apps too right? If so this is great news I've developed a couple small utilities before but used RealBasic before.

I really never had the time to get fully engaged with Objective-C. Playing around with Swift last night this is something I think I can pick up pretty quickly.
 
Thanks GrandM - I hadn't noticed you'd said VB rather than Visual Studio in your first post.

@int3: isn't that what Apple have done - gone with a nice to look at, easy to read and write language? The more I look at in the book the mroe I think "well, that syntax is obvious :)".

Regarding switching to programming in Swift rather than Objective C - can't we start right now? I read somewhere that you can compile Swift for iOS7 and 10.9, and since you can mix and match you could literally just change your language halfway through a project, were you so inclined. I might do just that (assuming that's true about iOS7).

At the risk of sounding like a noob here - does compiling a Swift app result in different native code (compared to compiling an Objective C app)? From the speed comparisons and fact they mentioned accepting Swift apps on the app store it sounds like it must do, but I figured using the same compiler meant it would be compiled into the same code. How's that work?

Ultimately Swift won't be compiled into identical machine code - since they state there is a performance benefit to using Swift. I don't know enough yet to understand why it's faster - removing some runtime overhead? More efficient compiler?(I doubt it).

The thing that intrigues me - the syntax is a bit more "scripty" than Obj-C / C / C++ / C#. It has a read-execute-print-loop which as I understand it implies it can be used an interpreted language in addition to compiling to native code.

Could Apple have much bigger plans for Swift than "just" iOS & OSX development - could Swift (or a subset of Swift) also be pushed as the successor to Javascript?
 
Ultimately Swift won't be compiled into identical machine code - since they state there is a performance benefit to using Swift. I don't know enough yet to understand why it's faster - removing some runtime overhead? More efficient compiler?(I doubt it).

The thing that intrigues me - the syntax is a bit more "scripty" than Obj-C / C / C++ / C#. It has a read-execute-print-loop which as I understand it implies it can be used an interpreted language in addition to compiling to native code.

Could Apple have much bigger plans for Swift than "just" iOS & OSX development - could Swift (or a subset of Swift) also be pushed as the successor to Javascript?

Oh man, that would be amazing. I so detest javascript.

So apparently "Swift interoperates with the ObjC runtime. It's not dependent on it." according to an Apple dev.
 
Oh man, that would be amazing. I so detest javascript.

So apparently "Swift interoperates with the ObjC runtime. It's not dependent on it." according to an Apple dev.

Not dependent on it? So you can write an application entirely with Swift code right? I'm curious how easy would it be to write an iOS app and then make it a Mac app and a Mac app to an iOS app, vice versa using Swift. Would this benefit greatly to OS X and possibly start seeing apps like Instagram or Facebook or YouTube on the Mac App Store?
 
Not dependent on it? So you can write an application entirely with Swift code right? I'm curious how easy would it be to write an iOS app and then make it a Mac app and a Mac app to an iOS app, vice versa using Swift. Would this benefit greatly to OS X and possibly start seeing apps like Instagram or Facebook or YouTube on the Mac App Store?

The logic for some things should cross over, but iOS vs OSX is very different once you get into the sensors/UI/etc...

You can write in Swift alone or ObjC alone or combine within the same program. But writing an iOS app is very different when you get to the UI.

Excellent point on the cross-platform issue. This is Apple only. Apple lives in Apple's world and wants the high end developers to create Apple only products.

Microsoft bragged not long ago about having 90% of the top apps. Apple has long been know as the 1st platform for an app. This is VERY important.

ObjC is NOT cross platform, however, it's a C ish type language. Apple wanted a way for developers to develop Apple only with less learning the language.

Swift is more an answer to "what do I have to learn to make an app" question we get here all the time.

How many noobs get lost when they crack open an ObjC book? Apple just fixed that and we'll see even more apps from even more developers.

This will go the way of web pages in the 2000's... everyone was a web developer back then... 10 year old kids were developers. Watch and see what happens to the app store in the next few years.
 
ObjC is NOT cross platform, however, it's a C ish type language. Apple wanted a way for developers to develop Apple only with less learning the language.
The language itself is cross-platform. The libraries and classes are available via GNUstep, and NeXT (bought by Apple) had a Windows port called OpenStep Enterprise.
 
I started out quite unimpressed, messing with it in a playground. (I came from ActionScript 3, and actually really liked Objective C once I got into it.) But then I tried messing with a full app and started liking what I saw a bit more.

The biggest thing I love about Obj-C was having the arguments inter spiced in the method names. When you call a class method, you have the parameter names in the parentheses like this:

Code:
myClass.myCreateRectAtX(42, y:50, width:20, height:20)

You can also add a # in from of a parameter name to make typing it's name necessary. Which is nice for either random functions, or the first parameter of a method. Which looks better in some cases:

Code:
myClass.myCreateRect(x:42, y:50, width:20, height:20)


So at least that's good. There's still other things I will have to work with (how does one use NSString methods to manipulate Swift Strings?) but I'm open to it. I'll try switching some of my current projects to it once I pan a few things out. (Typedef-ish things!?! How?)
 
Very impressed with the switch syntax. Not only can you have non-constant cases, but ranges, tuples, wildcards, and "cases with extra conditions" (i.e. the where clause).

I'm a little unclear how the "exhaustive" requirement works though - it's going to be far more difficult now to see whether your cases are exhaustive or if you need a default case. I'm not sure if putting a default in just in case is a good idea.

I like being able to selectively break/continue nested loops too by naming them.
 
I am sure the entire "State of the Union" keynote will the choc full of Swift talk. When it's up online to watch I'll be watching it ASAP.

I am actually surprised MR didn't write an article up for swift. MR covered almost everything else from the Keynote. I think Swift and iOS Appstore betas were the two wow moments for me. I didn't expect them. And both of them are making me think Apple is working on the successor to OS X.

The videos that have gone up are excellent, by the way. I strongly endorse Platforms State of the Union, Introduction to Swift, Intermediate Swift, Integrating Swift with Objective-C, and Swift Interoperability in Depth. There's also Introduction to LLDB and the Swift REPL, which I haven't watched yet but plan to. Hopefully later tonight we'll get Advanced Swift online as well (they had that session today). There's one more Swift debugging session tomorrow, too.

I think the people who run sites like MacRumors just aren't equipped to understand something like a new computer language and what it means. I don't really blame them for being so slow at realizing this is a big deal. As the more computer programming-oriented sites finish reading through the eBook, we'll see more articles and overviews from people who actually have that expertise to communicate about Swift effectively.
 
I think the people who run sites like MacRumors just aren't equipped to understand something like a new computer language and what it means. I don't really blame them for being so slow at realizing this is a big deal. As the more computer programming-oriented sites finish reading through the eBook, we'll see more articles and overviews from people who actually have that expertise to communicate about Swift effectively.

What more are you expecting MacRumors to do in regards to Swift?
 
Very impressed with the switch syntax. Not only can you have non-constant cases, but ranges, tuples, wildcards, and "cases with extra conditions" (i.e. the where clause).

I'm a little unclear how the "exhaustive" requirement works though - it's going to be far more difficult now to see whether your cases are exhaustive or if you need a default case. I'm not sure if putting a default in just in case is a good idea.

This has been done in other languages before. I've seen it in Racket, and others have pointed out that it's also in F#. I asked my programming language teacher about it (who developed it in Racket) and he said it was something trivial he hacked together one day.
 
"Python with braces."

So I can haz Python without risking my code being mangled because the auto-indent or tab size setting in the editor got changed?

I'm sold!


I am now wondering if GUI programs are within my grasp in Xcode. What will it be like learning Cocoa with Swift?

Conceptually, Cocoa is always going to be the hard part. That's why its not such a biggie that Apple is using a proprietary language (and Objective C, while not proprietary, never saw much adoption outside the Apple world).

However, as languages go, Objective C was a rather bizzarre mashup of old-school C and Smalltalk, which is as close to chalk and cheese as it gets (although arguably still better than C++). Swift looks as if it will be a lot more accessible to someone used to Java, Javascript, C# or Python. Even though many of the underlying concepts are technically the same as ObjC, the syntax is more familiar.
 
This has been done in other languages before. I've seen it in Racket, and others have pointed out that it's also in F#. I asked my programming language teacher about it (who developed it in Racket) and he said it was something trivial he hacked together one day.

Interesting, thanks.

Still, it's new to me and the languages I mostly work in (C#, Obj-C, Javascript) so it's a very welcome addition.
 
Anyone else notice the slight pause followed by the complete lack of excitement following the "we wondered what Objective C would be like without the baggage of C" line?

I know what I was thinking, and I assume a lot of other people: "the problem with Objective C isn't the C parts!"

Now however, what I've seen of Swift looks beautiful!

What do people think?
Go back and watch the keynote again. After that line, there were definite anticipatory Ooooh's and Ahhh's from the attendees.
 
Go back and watch the keynote again. After that line, there were definite anticipatory Ooooh's and Ahhh's from the attendees.

Hah, I very much agree. For every minor announcement there was the typical applause and some guy(s) going "Woo! Woo!". When Craig mentioned that line about Objective-C, there were gasps. It's been a looong time since there was an Apple keynote announcement so unanticipated (yeah, thanks Macrumors!! ;) )
 
Can't be bothered re-watching, I'll take your word on it. Nerd that I am it was certainly the coolest thin given seen in a keynote for a while!

That whole whooping and getting overexcited thing - is that normal in America? I'd be too self conscious to do that, an enthusiastic clap is as exuberant as I get.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.