Apple shows off Swift, its new programming language

Successor to Objective C has "none of the baggage of C."

Apple announced on Monday that it has developed a successor to its venerable Objective C with a language it's calling Swift. Providing a new language with "none of the baggage of C," Swift code can still be mixed with standard C and Objective C code in the same project.

Further Reading

OS X 10.10 gets a new design that borrows from iOS 7 without cloning it.

Swift seems to get rid of Objective C's reliance on defined pointers; instead, the compiler infers the variable type, just as many scripting languages do. At the same time, it provides modern features similar to those found in C++ and Java, like well-defined namespaces, generics, and operator overloading. From the few fragments of code shown during the demo, Swift appears to rely heavily on the dot-notation that Apple introduced in an earlier iteration of Objective C.

The new language will rely on the automatic reference counting that Apple introduced to replace its garbage-collected version of Objective C. It will also be able to leverage the compiler technologies developed in LLVM for current development, such as autovectorization.

Apple showed off a couple of cases where implementing the same algorithm in Swift provided a speedup of about 1.3X compared to the same code implemented in Objective C. It also showed off a Swift "playground," where code is compiled as it's typed and the output is displayed in a separate pane of the editing window. The goal here is to allow developers to test code fragments without having to recompile an entire complex project.

Use of Swift will be supported as soon as the next version of Xcode is released—it's currently available in beta form to registered developers, and will presumably see more widespread release during OS X Yosemite's public beta later this year. Apple also promises to release a free iBook on the language's syntax later today.

Swift code will still be able to appear mixed in with standard C and Objective C code in the same file.

This massively limits what they can do with the language.

How so? Mixing languages in the same file is nothing new...

It's nothing new, but it still limits what can be done. What happens if I declare a C macro before the code block? Does it run there? If it does, then that means the new language has the legacy of C macros. If not, then it's a strange inconsistency.This is just one example.

I think it's the same as Objective-C, which means there is no such thing as a "type".

Types only exist at compile time in Obj-C. At runtime everything is just an object, and all objects are capable of the same things. If you ask an object to do something it doesn't know how to do, your app will crash.

But since they do exist at compile time, you'll get build warnings if you do anything that expects a different class to what something will actually be at run time.

I wish they would have named it something more unique. Trying to do google searches for swift is going to suck.

Searching for "swift programming language" is too much?

It might be..if there wasn't already a programming language named "Swift". Very sloppy of Apple--I would have expected a better search before using a name which I'm sure they are going to try to trademark

I wish they would have named it something more unique. Trying to do google searches for swift is going to suck.

Searching for "swift programming language" is too much?

It might be..if there wasn't already a programming language named "Swift". Very sloppy of Apple--I would have expected a better search before using a name which I'm sure they are going to try to trademark

At the bottom of apple.com/swift website they at least acknowledge the other languages existence.>Looking for the Swift parallel scripting language? Please visit http://swift-lang.org

I wonder what the performance will be like? Performance concerns are a big reason most games don't use the Objective C frameworks Apple provides when they can avoid it. Even John Carmack tweeted that Objective-C had performance issues.

Reading that it uses Cocoa made me anxious. I'm hoping you can run (or even write) Swift programs on Linux, but it seems doubtful this will happen. Sad - I think the scientific community could make good use of this language, but OS X-only is a hindrance for HPC applications.