WWDC 2014: 10 things you need to know about Swift

WWDC 2014: 10 things you need to know about Swift

Summary: Here are 10 things you need to know about Apple's new Swift programming language.

SHARE:
TOPICS: Mobility, Apple
24

Apple chose the WWDC 2014 keynote to unveiled to developers a new programming language called Swift. Here are 10 things you need to know about this new programming language.

Swift
(Source: Apple)
  1. Swift is Objective-C without the C: This new language is being billed by Apple as a "fast, modern, safe, interactive" programming language. This idea behind it – based on what we've seen from the WWDC 2014 keynote – seems to be to make building apps easier than ever.

  2. Works in iOS and OS X: Swift isn't just for creating apps for iOS devices, but developers can also leverage it to create apps for OS X.

  3. Swift is fast: According to Apple's figure, Swift blows Python and Objective-C out of the water when it comes to tasks such as complex object sort and RC4 encryption. This, according to Apple, allows developers to spend more time creating apps and less time optimizing code.

  4. Modern: Swift includes modern features such as multiple return types, closures, generics, type interfaces, namespaces, and much more. Bottom line here is that developers won't be giving anything up by choosing Swift over Objective-C.

  5. Fits right in: Swift isn't going to upset developer workflow because it can fit right alongside Objective-C and C, so developers can use it as and when they feel is appropriate, allowing them to create mixed-language apps.

  6. New language, same infrastructure: The new Swift language fits right into Apple's existing Cocoa and Cocoa Touch framework, it is built using the same LLVM compiler, it uses the same optimizer and autovectoring and the same ARC memory manager, and the same runtime as Objective-C.

  7. Easy debugging: The debugging console in Xcode contains an interactive version of the Swift language built right into it called Interactive Playground. This means developers can use Swift syntax to evaluate and interact with a running app, write new code to see how it works in a script-like environment, or even use it to develop new algorithms. This is available from within the Xcode console, or in Terminal.

  8. Eliminating unsafe code: Apple has designed Swift to do away with entire classes of unsafe code. Variables are always initialized before use, arrays and integers are checked for overflow, and memory is managed automatically.

  9. Migration: Apple is making it possible – and easy – for developers to migrate apps from using Objective-C to Swift to improve architecture, logic, and performance.

  10. Play with it today: You can download the Xcode 6 beta and peruse the language guide today.

Topics: Mobility, Apple

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.

Talkback

24 comments
Log in or register to join the discussion
  • Will be Swiftly forgotten.

    .
    Owl:Net
    • I guess you'll be OwlllllllllllllllllllllllllllllNet by then

      .
      Smalahove
    • Wish you could be!

      If you have nothing useful to say, why not shut up?
      jorjitop
    • A language can be OS Independent

      Just as you can get iTunes for Windows, you could [in theory] get Swift for Windows.
      Developing IOS apps without a Mac may sound like heresy but it broadens the penetration into the Windows world.

      Next target: replace Visual Studio.
      alan_r_cam
  • Actually quite the opposite Adrian

    it appears to be the C without the "objective C".... looks far more classically C oriented than Objective C, which basically just does the baseline C thing, with the messaging workflow of Apple's on top of it.
    Mac_PC_FenceSitter
    • It's very much Objective C.

      The objects, types are all there. From NSDictionaries to NSStrings.

      I have no idea where you get your idea it leaves out Objective C.
      Bruizer
      • That's Framework and Cocoa

        Stuff that was already largely available in C++. Objective C's main characteristic is smalltalk style messaging for all of its, OO, and that appears to be largely gone in Swift.

        I repeat and reiterate - this is more C oriented than Objective C is!
        Mac_PC_FenceSitter
    • Yea...

      Well it looks quite C like from the pictures... really like a cross between C, Python and a bit of Java..
      Jimster480
    • You're clearly looking at the wrong thing

      I don't know what you've been looking at, but it isn't Swift.

      This language has code as first class objects, it has closures, it has automatic memory management.

      It doesn't have any way to access pointers, or write to random addresses in memory.

      It's not even vaguely C. It's objective C, as evolved, with the rough edges taken off.

      Multiple returns will be such a relief.
      Henry 3 Dogg
  • But its just Apple. Hope its OSS (not holding my breath)

    That way someone could create a Swift for JVM or CLR.
    MeMyselfAndI_z
  • Proof that Apple management is COMPLETELY BRAIN DEAD

    Apple should have adopted C# instead of implementing a language that is LITERALLY 10 years behind. It's better than Java, although that's a pretty low bar. Calling this a modern language is just silly.

    Where is the LINQ like functionality?
    Where are the attributes?
    Where is the native async functionality?

    The omission of these things is truly unforgivable. If they had a scintilla of intelligence, they would have simply adopted C# and had hundreds of thousands of libraries and BILLIONS of lines of code ready to be ported.

    Horrific decisions like this is why Microsoft execs sleep well at night. Apple is having a good run, but they're dead in a few years.

    P.S.

    Did they announce a real UI language because Auto Layout is a complete effing joke.
    jackbond
    • You're not still spamming every thread you can find about Linq are you?

      BTW, you've already been told you're wrong about Objective C and async.... yes it can do async, it has always been able to do async and threading!
      Mac_PC_FenceSitter
      • I've got a MacPro sitting right next to me with XCode...

        and have an app in the store. I doubt you even know what a variable is. So spare us your lecturing until you actually know what I mean by native async. Oh, and I've read the Swift language spec, where is the chapter on reflection? Oh, they forgot that? PATHETIC. Can you mark methods private, public, or protected? No? Seriously, who designed this garbage? I could go on, but it would be a waste of time. Swift is a bucket of pigvomit designed by amateur hacks. It's a slap in the face of Apple developers everywhere, because Apple is rolling in BILLIONS of cash, and could easily put out a good language.
        jackbond
        • Amazing

          Seriously, you're pathetic. The instant they disagree with you, the assumption is that obviously they know so much less than you. And you're going from a not-even-completed book about a language that they just showed off as at a developer conference.

          It didn't register in your mind that they could possibly be showing off a product that isn't completed yet.

          Or maybe it did, and you really are this pathetic.
          Michael Alan Goff
          • An incomplete language that's going to be shipping this fall???

            That is the basis of their platform going forward???

            It isn't an assumption that they know much less than I do; their brain dead comments prove it. Languages aren't things you whip up overnight, and the lack of access modifiers is glaring evidence that these guys are either hacks or are unwilling to tell their managers, this crap isn't ready.
            jackbond
          • It hasn't been done overnight

            This is the work of 4 years.

            Also, I take it C# started out able to do everything it can do today in your world? Because, ya know, in the real world it has been something that has grown and evolved.
            Michael Alan Goff
    • Or instead of using crappy C#

      They could have just gone to C++ or Java which is what everything else uses. NT (nice try) though.
      Jimster480
      • I doubt you've ever written a single line of code

        Go ahead, tell us why C# is crappy.
        jackbond
      • Or since they borrowed so much from Python...

        ...maybe just code in Python? You won't have to pay Apple money and you won't be tied to one OS either. And if you wanted a statically typed Python there's always Boo (for .Net) or Genie (which transcodes to Vala which transcodes to C).
        jgm2
    • If Microsoft had any sense, C# wouldn't exist.

      Proof that Microsoft management is COMPLETELY BRAIN DEAD

      If Microsoft hadn't fragrantly ignored the licence terms of Java and tried to subvert it to entrap developers into MS' own none standard version, then they wouldn't have ended up being panicked into putting out their own flawed alternative language.

      Looks like Google are going to end up with a similar mess in Android.

      When I'm working in an object oriented environment, the last thing I want to be doing is writing queries, so LINQ is exactly what I don't want.

      There's lots of attributes.

      The native async functionality is on the Tread object.
      Henry 3 Dogg