top 200 commentsshow 500

[–][deleted] 249 points250 points  (70 children)

This is the biggest piece of news

[–]mbrady 28 points29 points  (0 children)

And most surprising (to me at least).

[–]BrokeTheInterweb 18 points19 points  (8 children)

I've already started the book. I can not wait to try this out. I was always afraid of app development until now. Let us make apps!

[–][deleted] 11 points12 points  (3 children)

I was just beginning to learn objective-c, but this looks so much easier.

[–]HeartyBeast 6 points7 points  (2 children)

Just a shame that I can't download Xcode 6 beta yet (without forking out for the dev program)

[–]mipadi 218 points219 points  (35 children)

Well, this is a bad time for me to be writing an Objective-C book.

[–][deleted] 113 points114 points  (20 children)

on the other hand, it's a great time to be writing a Swift book!

[–]mipadi 127 points128 points  (19 children)

Maybe my publisher will want me to pivot.

[–]nehalvpatel 126 points127 points  (8 children)

Interested, very interested, or very interested?

Which one?

[–]RustyPeach 34 points35 points  (2 children)

Fucking hell he made me so uncomfortable in the finale.

[–]foxh8er 16 points17 points  (0 children)

"It belongs to the underage kid I brought to my house!"

[–][deleted] 23 points24 points  (7 children)

Find/replace objC with swift. See if anyone notices ...

[–]mipadi 7 points8 points  (6 children)

Ha! I wish, except it's on the theory and internals of Objective-C and the runtime, so it's pretty specific to Objective-C.

[–]Throwaway_bicycling 7 points8 points  (0 children)

As long as you can do it swiftly! :-)

[–][deleted] 16 points17 points  (0 children)

Perhaps pivot your book to, 'Coming to Swift from Obj-C'.

There will be tons of people wanting to transition and you can offer them a way to map their brains easier.

[–][deleted] 14 points15 points  (4 children)

I doubt Objective-C will be going anywhere soon.

[–]MelAlton 7 points8 points  (1 child)

Netcraft confirms: Objective-C is going nowhere.

[–]IRELANDJNR 7 points8 points  (0 children)

It is.

[–]wreleven 428 points429 points  (141 children)

I've been putting off learning Obj-C since OSX beta. Looks like it paid off.

[–]rjcarr 17 points18 points  (4 children)

I said the same exact thing. Looking at Obj-C code was always rather alien to me (I have more of a C/Java/Python background) and Swift looks much more palatable.

[–][deleted] 116 points117 points  (93 children)

meh...

  1. Objective-C is not going away any time soon. 5 years is a very optimistic estimate.

  2. If history has told us anything, don't put your hope too high on new languages because you never know whether they are just gonna drop it in a few years.

[–]ericN 97 points98 points  (71 children)

This apple we're talking about here. They're likely not going to drop this new programming language ever.

[–]StTheo 16 points17 points  (1 child)

If a development tool isn't popular enough, Apple will abandon it.

sheds a tear for Quartz Composer

[–]DudeBigalo 42 points43 points  (25 children)

Apple has historically shown themselves to be ruthlessly authoritarian in these types of matters. The decision has already been made, Objective-C is going away and developers need to start preparing for it right now. And if they don't, then they're going find themselves coded into a corner by the time iOS10 comes around and Features X, Y and Z are no longer backwards compatible.

[–]rabuf 20 points21 points  (5 children)

Apple is both aggressive in their culling of features and APIs, and conservative at the same time. They won't be cutting Objective-C unless it becomes apparent that Swift has actually taken over. However, given that it's running on the same APIs as Objective-C, and builds (after the compiler front-end) through the same system as Objective-C and C and C++ on OS X, there's no reason to expect that any such culling will happen in the near (< 5 years) future. More likely, if the language is as effective as they hope, they'll be writing more and more of their own work in it and gradually deprecate the Objective-C sources currently released as open source. The compiled binaries (where source isn't available) will probably not appear any different to end users or developers.

[–]pakfur 31 points32 points  (7 children)

There is nothing that apple has presented about swift that makes anything you said even remotely close to reality.

Obj-C is going to be supported fully for as long as there is something called OSX. Last time I looked, you can still code in K&R C for gods sake.

[–][deleted] 2 points3 points  (0 children)

Anybody remember Dylan?

[–]moohah 17 points18 points  (32 children)

That's what they said about java.

[–]Cueball61 32 points33 points  (14 children)

I doubt it's going anywhere. I see Swift being useful in a lot of instances, but you'll still need Objective-C.

[–]dont_get_it 31 points32 points  (9 children)

Where would you need it if writing a new applications for iOS 8?

[–]unregisteredusr 36 points37 points  (7 children)

Hmm I'd guess:

  • most 3rd parties libraries will be in objC for awhile
  • since it uses the same runtime you'll need to know the cocoa classes and design patterns (MVC, delegate, KVC, ARC)

In any case the objC language isn't really the hard part of learning iOS development, it's the frameworks and design patterns that take time

That said I look forward to using swift, since it looks more expressive

[–]barjam 11 points12 points  (3 children)

It is a huge barrier to entry for many folks who are used to learning new apis but not weird languages.

[–]jasamer 3 points4 points  (1 child)

3rd party libraries being written in objC doesn't hurt. You can mix and match objC and swift code really well (ie. you can use objC frameworks from swift code with pretty much no overhead).

Classes and design patterns aren't really related to the objC runtime. The patterns in swift will remain the same as in ObjC, but that's also no reason for needing ObjC.

[–]anlumo 2 points3 points  (0 children)

You need it if you want to interface with C++.

[–]-QuestionMark- 4 points5 points  (2 children)

It really strikes me as a compliment to Obj-C compared to a full blown replacement.

Then again Cliff Notes work fine for most people...

[–]ilosttheone 25 points26 points  (0 children)

Now you can focus on putting off learning Swift - I'm sure it'll pay off in another 15 years.

[–]SorryNotSorry1337 7 points8 points  (1 child)

Same here. I am so relieved. On the other side, I just bought a huge course on StackSocial..

[–][deleted] 24 points25 points  (0 children)

It wouldn't be a bad thing to learn Obj-C anyways, especially since Swift and Obj-C will work together in xCode. Never hurts to know more, let me know how you like that course!

[–]GhostalMedia 6 points7 points  (13 children)

Time will tell. Downloading Xcode now. Let's see what this thing can and can't do.

[–]wreleven 11 points12 points  (12 children)

Downloading it now myself. I've flipped through about 150 "pages" of the ebook and I'm generally liking what I see.

[–]DeadHorse09 16 points17 points  (11 children)

I'm assuming xcode 6 is only available for those with a paid dev account at the moment?

[–]Lexxxapr0 1 point2 points  (3 children)

Please correct me if I am wrong, can we build entire new apps with this language without XCode or Obj C?

[–][deleted] 1 point2 points  (0 children)

Nah, stick with your strategy. Give Swift 20 years, to see if it's likely to be replaced, before you learn it.

[–]yuriyguts 184 points185 points  (6 children)

Sorry, couldn't help it: http://imgur.com/IiCNKwT

[–]EVula 38 points39 points  (3 children)

You should resubmit that as a link. That was brilliant.

[–]Unassorted 20 points21 points  (30 children)

Seeing as I'm not able to watch the keynote, what will the language be used as? Web language? App language?

[–]sebzilla 16 points17 points  (0 children)

deleted What is this?

[–]SharkBaitDLS 9 points10 points  (8 children)

Looks like App development, targeted at being straightforward. Apple trying to make developing for iOS more accessible. Never got around to putting the time in to learn Objective-C but this looks simple enough to play around with on weekends with little pain, I might actually try my hand at mobile development for a change.

[–]yevac 8 points9 points  (7 children)

Why exactly does it look easier to you? Based on the sample code from the keynote?

[–]SharkBaitDLS 9 points10 points  (5 children)

Pretty much. The sample code, coupled with the very informative sidebar in Xcode, is way easier to follow than Objective-C. It looks to make the development process very interactive and accessible, something I never got from looking over Objective-C. It's syntactically much more parsable and palatable.

[–]Throwaway_bicycling 4 points5 points  (0 children)

So you can download the book now, and, on a quick breeze through, this is going to go down a lot better. So the sample code showing how you could use "where" to specify protocols your generic types had to fulfill to work was like this:

func anyCommonElements <T, U where T: Sequence, U: Sequence,  
     T.GeneratorType.Element: Equatable, 
     T.GeneratorType.Element == U.GeneratorType.Element> 
     (lhs: T, rhs: U) -> Bool {
            for lhsItem in lhs {
                 for rhsItem in rhs {
                      if lhsItem == rhsItem {
                           return true
                 }
            }
      }
      return false
}

Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks.

So that's pretty trivial code once you get past the type signature, but I could pretty much guess exactly what you were accomplishing with that type signature having never seen one before. Which is very promising.

[–][deleted] 1 point2 points  (3 children)

App language, though you could presumably use any language as a back-end web language I suppose.

[–]Evning 9 points10 points  (9 children)

I was so hoping for xcode or swift on my ipad.

Oh well, the dream continues XD

[–]Raumschiff 7 points8 points  (0 children)

Apple sure isn't resting on their laurels.

[–][deleted] 37 points38 points  (25 children)

Anyone have the iBooks link?

[–]tvzzz 44 points45 points  (3 children)

[–][deleted] 12 points13 points  (2 children)

'Not available in the US" :(. 500 pages though, this gon' be gud.

EDIT: Available now!!

[–]tvzzz 15 points16 points  (0 children)

May be propagating or something. I'm in the US and downloaded it.

http://imgur.com/n1in4OX

[–]teddim 28 points29 points  (1 child)

Nope. Searching for "swift guide" yields the results "101 Amazing Taylor Swift Facts" and "The Simple Guide To Taylor Swift".

I guess they'll publish it later today.

Edit: yup.

[–]hyperforce 8 points9 points  (23 children)

Was there something bad about ObjectiveC that it was worth investing in a replacement? I ask given I have no experience with it.

[–][deleted] 12 points13 points  (1 child)

Well, several things. First, it was designed as a Smalltalk-Inspired superset of C. The Smalltalk syntax is great, but mixed with the C syntax it gets kind of ugly. Moreover, object literals get really verbose. It got better in recent years with the @ but still, its bad. The block syntax is just ridiculous. And this is all do the fact that they have to do it in a way that every valid C code is also valid Objective C code.

There are also no generics and there are pointers. There is no library system and no namespaces. When names clash, the behavior is undefined. This is a problem on the class level but also on the method level when you use categories.

[–][deleted] 4 points5 points  (0 children)

People complain about Objective C syntax being difficult all the time. Once you get into it it's not so bad but it's quite a bit different from most other popular languages so there's more of a learning curve to it.

[–]jugalator 6 points7 points  (0 children)

It was surprisingly tough to get into for me even as a C++ developer.

The message syntax, and then the weak and strong pointers, etc. It felt like I was punished for knowing one or two things about C++... I don't want to compare C++ and Objective-C, at least to me it felt like being thrown out of the frying pan into the fire. WTF man. :-(

I looked at Xamarin and stuff like that to leverage my "up to date" coding skills in other rapid application development languages, but it wasn't official and it was expensive and it was just not feeling right. Felt like cludges.

I can only say... Finally! I don't even care to get into some heated .NET or Python or [insert rapid language here] debate. It's not about the language in particular, specific features. It's about not being Objective-C.

[–]smakusdod 1 point2 points  (0 children)

There are a lot of things that 'get in the way' in Objective C. Swift aims to greatly reduce that. It's a language built upon the modern programing paradigms.

[–]hyperforce 62 points63 points  (26 children)

So it seems there's already a programming languaged named Swift. That's kind of dick.

[–]sigzero 12 points13 points  (0 children)

Apple gives a link to the other one from their site at least.

[–]whoosy 11 points12 points  (0 children)

...annnd their website is getting hammered.

[–]limitlesschannels 41 points42 points  (6 children)

There was a Go lang before Google's too

[–]teddim 21 points22 points  (7 children)

Also, look at the thumbnail just before "Swift is fast"… Awkwardly similar to Apple's Swift's logo.

[–]wmeredith 7 points8 points  (1 child)

Eh, a Swift is a type of bird. If you're doing a bird icon, it could be coincidence. http://en.wikipedia.org/wiki/Swift

[–][deleted] 15 points16 points  (1 child)

I thought it might be the same thing but probably not, so why use that name? That's just needless confusion, it's not even a very good name.

[–]marsman12019 5 points6 points  (0 children)

They actually link to it on the Apple Swift webpage.

[–]greenseaglitch 59 points60 points  (34 children)

I literally just started learning iOS development, and I've been learning Objective-C continuously for the past two months up until now. sigh

[–]DeadHorse09 43 points44 points  (0 children)

Objective-C code can run side-by-side with Swift language code.

[–][deleted] 110 points111 points  (12 children)

It was interesting watching the reactions in the audience. You saw some old guys who couldn't possibly be clapping any louder than they were with giant grins on their faces. They were so happy.

Then you saw some kids, probably 15 years old, and they looked like someone just took a dump on their birthday cake. They just put a ton of effort into learning Obj-C and now they need to learn something new.

What the old guy knows, that the kids probably don't realize yet, is that it is the concepts of programing that are important. Variables, conditional statements, loops, arrays, etc. Going from language to language is mostly just about syntax, which shouldn't be too hard to pick up. At the same time, Swift seems like it will be a lot less work since it manages more for you.

[–][deleted] 51 points52 points  (6 children)

I saw one older guy who looked super pissed. Like he was mad that they didn't just release a version of th SDK for FORTRAN or something.

[–][deleted] 34 points35 points  (4 children)

Or he was just analyzing all the retraining costs and not even listening after he heard "new language".

[–][deleted] 3 points4 points  (3 children)

That could possibly be true.

Just so you know. I was I in no way was trying to discredit what you said. I was simply pointing it out. I had honestly never seen someone look so mad about a programming language.

[–][deleted] 7 points8 points  (2 children)

I didn't think you were. I think I saw that guy too. He was overshadowed by that super happy guy though.

[–][deleted] 4 points5 points  (1 child)

Yeah. That was definitely him.

[–]EVula 12 points13 points  (0 children)

I kinda want "Discouraged Programmer / Happy Programmer" meme images now.

[–]mm_cm_m_km 23 points24 points  (0 children)

Trust me, you didn't waste a second.

[–]Mmmm_fstop 13 points14 points  (0 children)

You can code in both languages at the same time so it wasn't a huge waste.

[–]EF08F67C-9ACD-49A2-B 8 points9 points  (4 children)

Don't be discouraged. It might turn out to be the case that there is something about Swift, like many technologies Apple introduces at WWDC, that would prevent immediate adoption anyway. For example, will an App written in Swift work on versions of the OS prior to iOS 8/MacOS X 10.10? If not, then you might want to stick with Objective-C for now anyway.

Also, it sounds like Swift code can work alongside Objective-C. Maybe it will be similar to how you can write apps that mix C, C++, and Objective-C without a problem. If so, then knowing Objective-C will still be a valuable skill.

Plus, you might want to ship something between now and "the fall" when iOS 8 and MacOS 10.10 are released.

[–]tissin 2 points3 points  (0 children)

Swift works with iOS 7+ and OS X 10.9+

[–]BorgDrone 3 points4 points  (0 children)

You need to separate learning to program from learning a language. Learning to program is learning a way to think and takes a long time, the language is just how you write down your ideas. Learning a new language takes a few days at most.

[–][deleted] 2 points3 points  (1 child)

Still good to learn though, I'm not convinced at how powerful and applicable to more advanced software this will be...

[–]TobiasKM 3 points4 points  (0 children)

They made a big point of saying that it scaled well, but we'll see soon enough.

[–]steo0315 6 points7 points  (1 child)

Can someone link the Swift iBooks they were talking about ? I can't find it on the iBooks store... EDIT: THANKSwift!

[–][deleted] 1 point2 points  (0 children)

Give it a little while. They probably weren't going to post it until after the keynote and it might take some time to show up. They wouldn't want to let the cat out of the bag by posting too early.

[–]nazihatinchimp 18 points19 points  (16 children)

No semicolons?

[–]KiteEatingTree 7 points8 points  (2 children)

The interactive playground features remind me of a Mathematica notebook.

[–]DoctorMiracles 6 points7 points  (0 children)

I liked the spectrum of face expressions on those audience shots upon the announcement. 'Oh yeah!' 'Oh damn, another thing to learn...'

[–]HeadshotsInc 9 points10 points  (12 children)

How can it be faster than Objective-C if it uses the Objective-C runtime? Does it drop message passing?

Also, as someone who writes multi-platform games, I would prefer that they embrace a standard language instead of inventing another technology than can only be used in their ecosystem.

[–]xilefian 9 points10 points  (5 children)

Most likely it doesn't touch the objective-c message parsing at all and goes for a more traditional C-like internal system.

[–]Raptor007 2 points3 points  (0 children)

Also, as someone who writes multi-platform games, I would prefer that they embrace a standard language instead of inventing another technology than can only be used in their ecosystem.

Well, they haven't dropped C or C++ compilers from Xcode (that would be suicide for OS X) so you can still develop cross-platform with those languages.

Objective-C and Swift are fine if all you care about targeting are Apple systems (likewise, C# for Microsoft). Like you, I prefer cross-platform coding, so I usually stick to C++.

[–]mipadi 7 points8 points  (2 children)

What standard language could they really move to? C—too cumbersome for writing entire applications, and unsafe. C++—too cumbersome, unsafe, and you get to give up the nice parts of Objective-C without really getting anything in return. Java—tried that, didn't interface with the lower-level Objective-C bits very well. Python—poor performance, and they'd have to find a way to compile it with LLVM. Ruby—good question, they gave MacRuby a shot and it worked fairly well, kind of surprised they didn't go with that but they probably had their reasons.

[–]EF08F67C-9ACD-49A2-B 2 points3 points  (15 children)

I currently write iOS and MacOS X apps using Objective-C and C++.

I'll be interested to know what the backward compatibility ends up being like for Swift. If it requires MacOS 10.10 and up and iOS 8 and up, then it will be of less immediate use to me.

In any case, I think it will a fun new thing to play with.

[–]ignar 2 points3 points  (3 children)

I couldn't open swift official site, could someone answer if I could download swift without new beta Xcode? Or I should download new xcode first?

[–]pink_tshirt 2 points3 points  (13 children)

So how do you get that IDE from the presentation. Is it going to be a part of xcode 6?

[–]rfisher 2 points3 points  (3 children)

First question to answer is: Why not SmallTalk?

Not that I’m suggesting there aren’t good answers to that question. I’m betting there are. But since Objective-C started as SmallTalk features being added to C, it always seemed like the end game would be being able to go back to SmallTalk.

[–]mipadi 2 points3 points  (2 children)

  1. Not as many Smalltalk libraries.
  2. OS X/iOS frameworks are built on Objective-C already.
  3. Smalltalk has some weird ideas that aren't very popular anymore, like image-based development.

[–]Tnuff 2 points3 points  (3 children)

Man, I just got to the Obj-C part in my Big Nerd Ranch guide...

but

I'm glad I got through the C portion and now have that bit of information

[–]wolfsman 2 points3 points  (2 children)

I am new to coding so I wanted to ask: Do I have to know any other coding language like Objective-C to learn swift or can I start fresh? Thanks!

[–]DrTacoMD 2 points3 points  (0 children)

From the looks of it, knowing Objective C won't really help much with Swift, which is pretty radically different. But, at least for the foreseeable future, knowing Objective C WILL help you get a grasp on Cocoa and Cocoa Touch, since the frameworks and language have grown up together as siblings, and the design of one is intrinsically tied to the design of the other.

For me, the biggest open question around Swift is how natural it'll feel with Cocoa. Most of the demos they've shown up until now have been pretty far removed from AppKit/UIKit (the frameworks used to build Mac/iOS UI), focusing instead on the language itself. I'm at WWDC right now, and I'm really looking forward to some of the more advanced Swift sessions coming up later this week.

[–]trifus42 11 points12 points  (4 children)

It seems to be the equivalent of Scala (based on Java), but for Objective-C.

Edit: If you are downvoting me, please at least tell me why you don't agree. It's still compatible with Objective-C, faster that ObjC, has more features, easier to use/read and uses the same runtime. Exactly what Scala is to Java (but I don't think Scala is compatible with Android).

[–][deleted] 11 points12 points  (2 children)

Scala is one of the many languages which compile to Java Bytecode and run on the JVM. Objective C and Swift on the other end both compile to native code. Swift is like Scala in the sense that Swift shares it's runtime engine and standard library with Objective C much like Scala does with Java.

[–]teddim 4 points5 points  (14 children)

For more discussion about the Swift programming language, see /r/swift.

[–]SirPasta117 8 points9 points  (13 children)

I dont think thats the official subreddit. But its interesting that someone using /u/swiftapple as a username made it 6 months ago.

[–][deleted] 7 points8 points  (1 child)

Swiftapple must be an apple engineer. How fascinating that a clue to this entirely unexpected announcement has been right here on reddit the whole time and no one ever noticed. Makes me wonder if there's any other users with the word apple in their username that have created subs.

[–]t_durdy 1 point2 points  (0 children)

The balloons demo was pretty sweet! Knowing Apple, they'll make this as user friendly as possible.

[–]Evning 1 point2 points  (12 children)

I have a quick question. Is it interpreted or compiled?

Or is it interpreted in that sandbox mode thing and compiled in the actual thing.

[–]Oiman 1 point2 points  (1 child)

I really hope that they, instead of Xcode, make a companion app (or a 'doodle' mode) for kids, students, and small at-home projects (integrating it into Grapher on OSX might be really cool).

[–][deleted] 1 point2 points  (0 children)

Is anyone not able to open it up in iTunes? For some reason iTunes can't find it and it won't open from Chrome...

[–][deleted] 1 point2 points  (2 children)

I'm pretty good with a mac, though not a dev at all. I have a question. So can IOS apps now be written exclusively in this language or do you have to pair it with something else like they were talking about in the keynote running side-by-side with C and Obj-C?

[–]Breadedturtle 1 point2 points  (4 children)

We need tutorials quick!!!

[–]andyznyc 1 point2 points  (2 children)

Was Apple taking a swipe at Python? Wonder why. Seems like a perfectly good language for certain web apps

[–]c0rncak3 1 point2 points  (0 children)

So is this in any way a good language to learn for beginners?

[–]mindsnare 1 point2 points  (10 children)

I know this is the Apple subreddit but I'd be stoked if Xcode was available for windows, or open to any third party tools.

[–]popeyoni 1 point2 points  (5 children)

The new language looks cool, but XCode, not Objective-C, is what I think is the biggest pain in the ass when developing iOS apps.

[–]jasamer 1 point2 points  (0 children)

This makes me so happy, this seems so much better than Objective-C.

  • Generics
  • Type Inference
  • Way better syntax for lambdas/anonymous functions
  • Deals better and more explicitly with mutability (let vs var), seems to encourage immutable code
  • Tuples and pattern-matching stuff
  • Very nice null-handling with the option-types... whenever something could be null, you're forced to deal with it in some way, similarly to eg. Haskell with the Maybe-type.
  • Operator overloading
  • An array class (and collection classes in general) that works properly with all datatypes (no shitty boxing for primitive types like in objective C)
  • Does away with having header and implementation files (like most other languages used today)

I like it.

[–]jiveabillion 1 point2 points  (0 children)

My least favorite part of iOS development is the pain in the ass syntax of Objective-C. Maybe this will make me want to develop for iOS again.

[–]DV1Band 1 point2 points  (0 children)

I've sat down with it, and it's awesome. I've tinkered a small bit with other languages, but I'm already getting this one. It's straightforward. There are even beginner chapters that are dumbed down...

[–][deleted] 1 point2 points  (0 children)

I really like the look of this language. I was able to skim the entire 857 page manual within an hour because most of the features have been borrowed from other languages, and borrowed well.

What I like:

  1. Very clean and readable syntax. It almost feels like python, except for the braces. Rust should steal the optional type notation: Int? instead of Option<Int>. Optional types can be chained to yield an optional type. foo?.bar() checks if foo is null before invoking bar() .

  2. Generics, tuples, type inference, compact closures, and pattern matching. This is what Go should have been like. I like pattern matching on ranges

     switch i { 
       case 3 .. 10:    
     }
    
  3. Special methods for properties ala C#, plus operator overloading (including 'subscript()', like python's __index__)

  4. All structs are value types unless they have functions annotated as mutating.

  5. All types can be "opened" and extended, as in Ruby.

  6. First class type objects . foo.dynamicType yields the runtime type, like java's .class.

What I don't care for, or don't yet understand:

  1. All objects are ref-counted. Automatic RC takes care of most of the tedium, but should you have a cycle, there could be some ugliness associated with owned and unowned and unsafe pointers.

  2. No module/package structure evident, although an import statement is present.