
Introducing Swift - pdknsk
https://developer.apple.com/swift/
======
kcorbitt
So it looks like the language isn't open source and won't target non-Apple
runtimes?

I'm not trying to troll, I just think that it's a pity that Apple tends to
limit the ecosystem and applications of its otherwise-great languages.
Building against LLVM ought to make it fairly trivial to make this cross-
platform.

~~~
United857
Is there anything to stop a independent implementation? Like C#/.Net and Mono?

~~~
yulaow
Well if the core of the language is licensed and closed source (is it?) and
they do not make a standard iso, it's really problematic to reimplement it in
another platform. Both from a legal that from a technical pov.

------
juvoni
Looks like Recruiters will now be seeking Swift Developers with at least 5+
years of experience.

~~~
CanSpice
Yeah, I saw @Stammy's tweet too.
[https://twitter.com/Stammy/status/473536229531586562](https://twitter.com/Stammy/status/473536229531586562)

~~~
davidw
By my count, approximately 1839 people have tweeted something similar so far.
The first one was pretty funny.

------
tdicola
I'm impressed that it looks like they're turning Bret Victor's demo into a
reality with playground. Check out his demo if you haven't:
[https://www.youtube.com/watch?v=PUv66718DII](https://www.youtube.com/watch?v=PUv66718DII)

Really, really interested and excited about learning Swift.

~~~
DanielRibeiro
Which is also similar to Elm's time travel debugger: [http://debug.elm-
lang.org/](http://debug.elm-lang.org/)

Direct link to Elm's demo similar to Bret's: [http://debug.elm-
lang.org/edit/Mario.elm](http://debug.elm-lang.org/edit/Mario.elm) (video:
[https://www.youtube.com/watch?v=RUeLd7T7Xi4](https://www.youtube.com/watch?v=RUeLd7T7Xi4))

------
arasmussen
Feels like they looked at a bunch of programming languages, took all their
favorite features, and then put them into one which still sits on top of the
ObjC runtime. And then added some Apple syntactic craziness.

For example:

var apples = 3; // mutable

let oranges = 5; // immutable

let summary = "I have \\(apples) apples and \\(oranges) oranges";

~~~
munificent
You say "Apple syntactic craziness", but "var" is identical to JS, et. al. and
"let" is identical to ML, et. al.

The string interpolation syntax is unique, but kind of makes since given then
\ is the escape character in C strings.

~~~
billyhoffman
"let" is JavaScript as well.

[https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Refe...](https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Statements/let)

~~~
seanalltogether
the typing system seems to be from ecmascript as well

var distance:Double = 70.0

~~~
munificent
This type annotation syntax comes from ML in the 70s (60s?).

~~~
Sami_Lehtinen
Programmers here? But they haven't ever heard of BASIC? LET has been used for
variables least since 1968.

~~~
zimpenfish
Hasn't it been used for binding in LISPs since the early 1960s? Swings and
roundabouts.

------
bigsassy
Is this related to Bret Victor's stuff? My mind was blown when I saw this
video 2 years ago, and I can't help but see similarities here:

[https://www.youtube.com/watch?v=PUv66718DII&t=10m42s](https://www.youtube.com/watch?v=PUv66718DII&t=10m42s)

~~~
kmfrk
Bret used to work at Apple. I don't believe in coincidences. :)

------
Xorlev
Looks like they pulled a Golang: [http://swift-lang.org](http://swift-
lang.org)

~~~
davidcbc
You do realise that link is completely unrelated to what Apple is doing,
right?

EDIT: Nevermind, my mistake. I thought the comment was about Apple was making
their own language like Google did with Go, not Go! already existing as a
language

~~~
pimlottc
That's precisely his point. There was already a pre-existing (but little-
known) language called Go when Google announced theirs.

~~~
davidcbc
Gotcha, my mistake. I thought the point was Apple was making their own
language like Google did with Go and he was just linking the wrong language.

------
mathieuh
> Looking for the Swift parallel scripting language? Please visit
> [http://swift-lang.org](http://swift-lang.org)

Did they not know or do they just not care?

~~~
hrayr
Looks like they took inspiration for the icon also. Look at the second to last
icon on that page.

~~~
tomgp
more likely both icons were inspired by the bird's distinctive silhouette

~~~
hrayr
I hate to admit, but dumb me didn't realize this was a bird. I thought swift
as in quick.

------
scrumper
"The debugging console in Xcode includes an interactive version of the Swift
language built right in. Use Swift syntax to evaluate and interact with your
running app, or write new code to see how it works in a script-like
environment. Available from within the Xcode console, or in Terminal."

Does this mean that we can use the Swift REPL in the Xcode debugger to explore
running ObjC programs? That would be enormous fun, not to mention very
powerful.

------
sunnynagra
EDIT: Link is live now.

Here is the link to the online documentation if you don't want to download it
on iBooks.

[https://developer.apple.com/library/ios/welcome_to_swift](https://developer.apple.com/library/ios/welcome_to_swift)

------
tlack
Really excited and surprised by this announcement. Anyone know the provenance
of this language? Who built it, what are its intellectual roots?

~~~
Alphasite_
Well, Chris Lattner is involved at the very least, which is a good sign.

------
varenc
It seems like the only way to view the programming language documentation is
on iBooks on an iOS device? For a programming book, this is ridiculous.

Edit: The latest version of OS X does support iBooks. Lets hope you have that.

~~~
k-mcgrady
iBooks app is also available on the Mac. As the language is Mac and iOS
specific it's not all that crazy.

~~~
varenc
hah, it seems iBooks is only available on Mavericks. Rather frustrating when I
just want to read the documentation.

~~~
r00fus
Given you will require Mavericks or Yosemite run Xcode 6 and code with it,
that makes for a sort of consistency, despite the frustrating closed-ness.

------
yulaow
Link to the EBOOK on iTunes: [https://itunes.apple.com/nl/book/swift-
programming-language/...](https://itunes.apple.com/nl/book/swift-programming-
language/id881256329?l=en&mt=11)

~~~
dom96
Is there any way to get this without installing iTunes?

~~~
bithush
Yes it is available at
[https://developer.apple.com/library/prerelease/ios/documenta...](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/index.html#//apple_ref/doc/uid/TP40014097)

------
jaxytee
Swift has a built in option type

“if let actualNumber = possibleNumber.toInt() {

    
    
        println("\(possibleNumber)  value: \ (actualNumber)")
    

} else {

    
    
        println("\(possibleNumber) could not be converted to an integer")
    

}”

Nice to see the Apple's language developers embracing functional programming
by providing a clean implementation of the Maybe Monad as well as support for
closures.

~~~
nardi
I love this feature, but it's not quite the Maybe Monad, which lets you
assemble a sequence of (possibly failing) statements together, and fail the
whole sequence if any of the parts fails (without if-statements or switching
of any kind).

~~~
anon1385
'Optional Chaining' sounds like it lets you join thing together to some
extent:

[https://developer.apple.com/library/prerelease/ios/documenta...](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/OptionalChaining.html)

~~~
nardi
Oh, cool! Straight out of CoffeeScript. Yeah, that's pretty much the monad
instance of Maybe.

------
Bytesouffle
[https://itunes.apple.com/en/book/swift-programming-
language/...](https://itunes.apple.com/en/book/swift-programming-
language/id881256329?l=en&mt=11) (direct link to iBook store).

Edit : Changed the link to en.

Does anybody have a direct link to the Xcode 6 beta ? Or mirror download link
? Thanks.

~~~
adricnet
Switch nl to your language code for best results. I used en.

Thanks for the direct link!

------
rabino
Elm has had a "time traveler" debugger for a while [http://debug.elm-
lang.org/](http://debug.elm-lang.org/)

~~~
nardi
For those interested, "A while" = since a few months ago, AFAICT.

------
MIT_Hacker
This will revolutionize programming education.

Interestingly enough, the time manipulation in Swift was inspired by a game
called Braid
([http://en.wikipedia.org/wiki/Braid_(video_game)](http://en.wikipedia.org/wiki/Braid_\(video_game\)))
released back in 2009.

This will help young programmers solidify the connection between giving the
computer logical commands and what is outputted on the screen immediately.

Reminds me of how excited I was when Processing
([http://www.processing.org/](http://www.processing.org/)) was released which
made it dead simple to interact with a screen and graphics. Didn't have live
feedback, but it made it incredible easy to understand OOP.

~~~
devindotcom
How do you see it as revolutionizing programming education? I'm pretty
ignorant in this area, but it seems like a very high level language that
abstracts a ton of stuff - and very platform specific too if I'm not mistaken.
Is that really where we want people to start? I would have thought either a
highly graphical language with buttons and widgets for early education, then
moving onto platform-agnostic stuff like java and obj c would be the thing to
do. Maybe you're talking about later stuff, college and beyond, which makes
sense - at that point specialization to this extent seems like a good idea.
But as I said, I'm pretty out of touch.

~~~
jimbokun
I work with someone who previously was a college professor teaching computer
science. The university decided to standardize on Mac and iOS hardware, and
teach how to program iOS apps as a way to make the CS program more popular.

Trouble was, teaching the entire XCode and Objective C tool chain was not a
particularly easy entry point for learning how to develop programs.

(Maybe there were other prerequisite programs, but still, you need to
understand C to really understand why a lot of things are the way they are in
Objective C, in addition to message passing and object orientation, pointers,
and other quirky stuff in order to really wrap your head around iOS
development.)

Swift and the corresponding tools look like they would have been a godsend for
teaching that class. A more practical way to get students started writing
programs they can actually run on their phone.

------
chenster
About time! Objective-C is increasingly becoming inadequate for Apple software
development. Apple knew that. They finally decided to do something about it.
If it goes popular the same as Microsoft C#, that would be a huge win for both
Apple and developers.

------
kybernetyk
Looks nice. But I wish one could interop it with C++ like Obj-C.

As it is now I won't be able to use Swift because of that :(

~~~
hodgesmr
What's the solution to this? Interact with C++ via Obj-C, and then interact
with that Obj-C with Swift?

------
wnissen
Still on an Objective-C runtime, so it's hard to see how the performance gains
they claim are achievable, but otherwise having an interpreted version should
be good for productivity.

~~~
twic
Correct me if i'm wrong, but Swift has static typing (with type inference, but
still with a strict type on every variable), whereas Objective C has dynamic
typing with optional type annotations. Having ubiquitous strong type
information available should make it much easier to generate fast code.

~~~
wnissen
Hm, maybe that's it. I thought typing was still dynamic because of the
multiple return types.

~~~
randomguy7788
guessing multiple return types are supported by just returning a tuple?

------
lsllc
Looks a lot like golang meets haskell:

func makeIncrementer() -> (Int -> Int)

EDIT: Why the downvotes? was just an observation not a criticism. Looking
forward to using it instead of Objective-C.

------
X-Istence
Complete history of variable state over execution time of a program is
AWESOME!

------
hugabuga
Couldn't help to think about Greenspuns tenth rule[0] when I saw the release
of Swift. Even though it's kind of neat with the REPL and at a first look
xcode looks promising.

[0]
[https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule](https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule)

------
frik
The Swift lang syntax looks like a mixture of JS 6, Go and Object-C/Smalltalk
- at least from the first sight.

------
orionblastar
I have a question.

Why doesn't Apple try to make easier to learn and easier to use programming
languages instead of focus on the more difficult ones like Objective-C?

Why not use BASIC, Python, Ruby on Rails, Java, or even Pascal for their new
language so you get more people to become developers and make iOS and OSX apps
in greater numbers because it is easier?

I mean they could have just used Monodevelop:
[http://monodevelop.com/](http://monodevelop.com/)

Made a tool to convert Winforms to Cocoa Forms to port some Visual Studio C#
and Visual BASIC apps to iOS and OSX, and win over the Windows-Only developers
to the Apple platforms?

This Swift language seems so hard to learn, almost like F# or something. Not
as hard as Haskell, but for the average developer it is going to be painful to
learn.

------
be5invis
Looks like C# with .NET Native, some sort of.

Playground is interesting.

~~~
_random_
Minus awesome IDE with automated refactoring.

------
dang
Buried as dupe of
[https://news.ycombinator.com/item?id=7835099](https://news.ycombinator.com/item?id=7835099).
(The idea is to have one discussion per major announcement on the front page.)

~~~
United857
What happened? Shouldn't the software disallow multiple submissions of
identical URLs?

~~~
dang
It does. We probably changed the url of the other thread; I don't remember
(there have been so many), but we usually add a comment indicating what we
did.

On the other hand, the duplicate detector is also quite porous—in most cases a
slightly different URL will get through. That's by design: we want the best
stories to have multiple cracks at the bat. It's easy to abuse, of course, so
we ask people not to abuse it. A small number of reposts is ok.

------
Nib
Guys, I'm not sure if anybody's noticed yet, but call it a co-incident or
what(make the "what" "copy"), but, another programming language with near
similar features already exists, though its not C based and some other stuff
is quite different but, yeah, see this : [http://www.linux.com/news/featured-
blogs/200-libby-clark/725...](http://www.linux.com/news/featured-
blogs/200-libby-clark/725638-swift-the-easy-scripting-language-for-parallel-
computing/)

------
jaydz
Looks like the xcode beta is only available to members who paid $99 :(

------
eliteraspberrie
I started reading the _Swift Tour_ and couldn't stop. It's compiled, and has
both functional and object-oriented features, and a nice syntax. I'm sold.

[https://developer.apple.com/library/prerelease/ios/documenta...](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html)

------
niutech
The Swift language resource center is in the works at
[http://swiftlang.eu](http://swiftlang.eu) \- right now it redirects to the
Apple website.

Meanwhile, there is the Swift eBook at
[http://book.swiftlang.eu](http://book.swiftlang.eu)

------
jason_dstillery
I can't find anything in the book or on the website about concurrency. I'm not
familiar with the Apple programming ecosystem, how is concurrency handled? Is
the lack of language-level support a concern or is everything shuffled off
into libraries and the runtime?

------
JimmaDaRustla
Love the "Done. Sold. Have me." comments when no one here has even used the
language yet...

------
avenger123
This is exciting. I can see myself getting into this. Dabbled with Objective-C
but it just didn't excite me.

If Apple's intent is to boost their developer base, this is one tremendous
boost. It seems to have the best of both dynamic and static languages.

------
msoad
For those of you who can't access the book because you don't have an Apple
device I've uploaded screenshots of first chapter here.

[http://imgur.com/a/AuzGw](http://imgur.com/a/AuzGw)

I did it because the book was free.

------
bshanks
[https://developer.apple.com/library/prerelease/ios/documenta...](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/)

------
timanglade
Let’s get together next week to talk about it :) [http://www.meetup.com/swift-
language/](http://www.meetup.com/swift-language/) (San Francisco / Silicon
Valley)

------
dferlemann
Feels like dynamic languages coupled with some smalltalk resemblance, plus the
playground which is kind like Mathematica? Looks pretty awesome! I'd itchy to
try it out...

------
sureshv
Direct Link:
[https://developer.apple.com/swift/](https://developer.apple.com/swift/)

The guides/reference link doesn't work yet...

------
ant_sz
After read some documents I think swift is a little like coffeescript but
still contains some Go syntax.

It's like a scripting language very much. Quite amazing isn't it?

------
emehrkay
How difficult would it be to have that playground preview for other langs? Im
willing to bet there is someone building a sublime extension right this minute

------
tdicola
Haven't had a chance to look at the docs for it yet, but will LLVM be the
compiler for it and will it support compiling Swift into its native bytecode?

~~~
craigching
Yes, it says so on the home page:

> Using the high-performance LLVM compiler, Swift code is transformed into
> optimized native code, tuned to get the most out of modern Mac, iPhone, and
> iPad hardware.

------
slig
Does this means that they're ditching Objective-C?

~~~
k-mcgrady
No. Swift works along side Objective-C. You can use both in the same project.

~~~
chenster
That'a also Microsoft said about VB.NET when they introduced C# in early 2000.
Now C# is a much more dominant language than VB.NET. It's a matter of
adaptation . Something it take a long time. But seriously, how could Apple
introduce a new programming language that would be possibly worse than
objective-C to master? I don't think so if it's not light years better than
OC. Perhaps better is a relative term, but from the syntax, new Swift
definitely has a modern objective language feel, and should pose much less
learning curve to newcomers. That's certainly a welcome sign.

~~~
k-mcgrady
Strangely I'm one of the people that loves the objc syntax. It's very verbose
but that also makes it very simple to understand. Same goes for nested square
brackets, they make it pretty simple to see how things are working. I'll
definitely be trying Swift though.

------
wuliwong
Ugh, none of the links work. :( Can't get the ibook, can't view the "guides
and reference", can't download xcode 6 beta.

~~~
Angostura
Book downloaded fine for me

~~~
lexy0202
Same here

------
coldcode
I as an Apple developer salute Swift. Yet more reasons to get jobs! Also
anything that makes programming swifter is a plus.

------
slantedview
A quick glance through the book - looks like a nice language, certainly better
than some of the stuff we use day to day.

------
chenster
What's to complain about? It's like Microsoft finally kills VB6 and moved on
to C#. Adapt or become obsolete.

------
alexgaribay
I'm super excited about this. I love Objective-C but I also enjoy all the nice
features of a high-level language.

------
thedangler
[https://swift.im/](https://swift.im/)

Kind of looks like they took their logo too. LOL

------
hayksaakian
serious question: why?

~~~
bobthedino
Here's a good way to answer that question:
[http://arstechnica.com/apple/2010/06/copland-2010-revisited/](http://arstechnica.com/apple/2010/06/copland-2010-revisited/)

------
mmastrac
Anyone feel like converting the epub from iBooks to a PDF/HTML page we can
read more easily?

~~~
pyvek
[https://developer.apple.com/library/prerelease/ios/reference...](https://developer.apple.com/library/prerelease/ios/referencelibrary/GettingStarted/LandingPage/index.html)
(tour, language guide, reference links, etc. at the bottom of the page)

------
galvanist
Where are the low level lightweight concurrency/parallelism features?

------
pt
swift-lang.org mentioned at the bottom of the page seems to be down.

~~~
davidcbc
It's an unrelated language that is being hammered by all the people Googling
"swift programming language"

------
yconst
I wonder if this brings us one step closer to developing on iOS...

------
outside1234
Why is this platform not JavaScript based (so we can leverage the largest
ecosystem in the world) or Python based or anything-else-that-exists based?

In other news, has Android killed iOS yet so we can stop worrying about Apple?
Can't happen soon enough.

~~~
krrishd
If you take a look at Swift, a lot of the different constructs are implemented
similar to how they would be in languages like JS or Python.

~~~
outside1234
I think that's my point. Why not JavaScript then?

The only reason I can see is vendor lock-in.

------
pkrefta
I zipped .html + .css from the book - here you go guys :)

[https://www.dropbox.com/s/nuxcbkjp7bpp7uc/swift_book.zip](https://www.dropbox.com/s/nuxcbkjp7bpp7uc/swift_book.zip)

------
otterpro
This is truly a game changer for me. Finally, I can develop for ios/osx
without the excruciating pain and torture of working with the antiquated and
ugly syntax of obj-c.

------
emehrkay
Looks like PHP (or any c-based lang). Exciting!

~~~
kybernetyk
I just returned to my IM client (did miss the swift live stream announcement)
and read: "Oh, cool, new language. And it has a REPL"

And all I thought was: "Please let it be a Lisp".

~~~
emehrkay
I guess you gotta go with what your customers (developers) would be most
comfortable with

------
Ixiaus
"Swift eliminates entire classes of unsafe code. Variables are always
initialized before use, arrays and integers are checked for overflow, and
memory is managed automatically."

Lol

------
chenster
I'm happy today.

------
_random_
In what way is it innovative? Seems like a mix of recent features.

------
sunkencity
a better version of ipython notebook!

~~~
dschep
But without the NumPy/SciPy/etc. ecosystem?

------
curveship
Am I the only one who thinks the name "Swift" sounds a lot like "Dart"?

------
AceJohnny2
This is completely unrelated to Swift, the Jabber IM app (and lib):
[https://swift.im/](https://swift.im/)

Edit: I pointed this out as I'm curious about trademark/logo clash.

------
sequoia
"...and you don’t even need to type semi-colons."

As an extremely paranoid & defensive Javascript developer, _you shut your damn
mouth!!_ :p /jokes

------
api
So they copied this idea for the IDE?

[http://www.lighttable.com](http://www.lighttable.com)

~~~
judofyr
Well, LightTable was inspired by Bret Victor's ideas. He worked at Apple
earlier.

