
A swift Introduction to Swift - gscalzo
http://www.slideshare.net/giordano/a-swift-introduction-to-swift
======
krat0sprakhar
> Unfortunately 95% of the complexity is in the massive API set, not language
> syntax.

Can't agree with this more. I'm a web developer (with Scala experience) and
was watching the WWDC live streaming. As soon as I heard about Swift I had
just one aim - download Xcode 6 and give the playground a go. Within two days,
I managed to go through the iBook on Swift. But I still don't have a single
app ready. Most of swift tuts teach only about the language and the Obj C tuts
are hard to port (for a beginner). The new language is surely more
approachable to newcomers but its still going to take time to learn the Cocoa
framework, Storyboard and other parts involved in building an app.

~~~
asolove
That said, the Cocoa/iOS ecosystem has better resources for diving deep into
its style and capabilities than any other I have worked with.

The Big Nerd Ranch set of books [1] is fantastic. It explains "how we do
things" and "how we learn about new things" for its community better than any
other book for any other community I've tried. It doesn't just teach a
language or show a few examples, but actually walks you through the experience
of reading documentation for, playing around with, and ultimately building a
finished app using a new API or part of the ecosystem. After you're done with
the books, there is plenty to learn, but you know where to look and how to go
about doing it.

Then I compare that to what it took me to become a web programmer. While it
seems "easy" now, the amount I had to read about http, OSes, browsers, the
dom, security, performance, etc. is astonishing. Without any of these topics,
I would have made terrible mistakes. And each of these topics was covered in a
separate book, which often showed best practices for that topic mixed into
code using poor practices with regard to the other topics.

[1] [http://www.bignerdranch.com/we-write/](http://www.bignerdranch.com/we-
write/)

~~~
krat0sprakhar
Absolutely. I am quite averse to IDEs (prefer Vim) but Xcode is just
fantastic! Committing the massive iOS API to muscle memory seems next to
impossible and I'm glad Xcode makes your life so easy (Can't say that about
Android / Eclipse certainly).

PS: Much thanks for Big Nerd Ranch! Didn't know of these guys before.

~~~
pookieinc
I'm the same way (averse to IDEs, preferring Vim over them) and while I
haven't tried Xcode, I've got to say, I'm really enjoying the opposite
direction of Visual Studio. Especially with ReSharper, it's one of the better
IDEs I've used. Haven't tried the latest VS (2013) but 2010 and 2012 have been
great. The only thing is, as of late, VS2012 feels a bit chunkier than 2010
did, making it feel slower. Having said that though, it's still very usable.

It's nice to have Vim for my Ruby/Python scripts and something like Visual
Studio for C#, I really don't mind given the lovely environment it provides.

------
gscalzo
I got mixed feelings from the presentation I have done on Swift, most of the
presents were scared by the huge size of the language and the mixing of
functional and Object Oriented programming, which can lead confusion into
developers, mainly the not so experienced ones. Any other comments?

~~~
teh_klev
As one who has shied away from IOS development because of Objective-C it looks
pretty attractive. My own background is C#, Python, Javascript and a
smattering of Java and Groovy. Swift has whetted my appetite to revisit IOS
development again, there's lots of familiar looking stuff there. I could
probably become dangerous in a couple of weeks or so, but effective inside a
month. Sure I'd need to learn the IOS SDK but that stuff is very well
documented.

That said I'm a developer with around 20 years experience under my belt so the
ability to learn new stuff quickly is in the blood, and I've got the advantage
of working for many years with different development paradigms.

------
dotnick
There was a relevant Ask HN thread [0] but it didn't get much traction so I'll
ask here:

What would you recommend to someone just starting out in iOS, starting with
Obj-c or diving straight into Swift?

[0]
[https://news.ycombinator.com/item?id=7875208](https://news.ycombinator.com/item?id=7875208)

~~~
gdubs
Aaron Hillegass wrote a post on this, and makes a case for learning
objective-c.

[http://www.bignerdranch.com/blog/ios-developers-need-to-
know...](http://www.bignerdranch.com/blog/ios-developers-need-to-know-
objective-c/)

* For those unfamiliar with Aaron, he's one of the foremost authors and teachers of Mac and iOS development -- going all the way back to NeXT. He's gonna be a little biased towards Objective-C, but what he has to say is definitely of interest.

~~~
vyshane
I've read this post. I would still recommend that you jump straight into
Swift. Objective-C has its own set of quirks and pain points. If I was
starting over, I would go straight to Swift. It's an altogether nicer and more
consistent language.

~~~
igrekel
I agree if just to not go back 15 years and start writing header files again.

------
abhilash0505
If one had done Ruby programming in its early days, he/she would come across
an epiphany. I tried swift and the best part was the similarity to Ruby and
the ease of use. Plus, loads of built in lib functions just make development
easier. Added to that, the amazing lldb support for Swift is wonderful.

But what's not so great?? The fact that there will be two languages with
greatly different syntaxes in the same file. It would just remind you of the
initial days of iOS programmer's surge when many realised that Objective C
file could also contain C code.

Some find this mixture of languages fun, and some would probably not feel the
same.

If the acceptance is the same as it was for Objective C, maybe this is the
Objective C 2.0 successor.

~~~
AlexanderDhoore
This IS the Objective-C 2.0 successor. Apple does not do acceptance tests.
(This is a good thing, if you ask me.)

------
leorocky
Regarding the slide with the Objective-C book on the trash can, probably don't
want to throw that out if you want to make use of C or (C++ in your .mm file).
Can you do that with Swift? Game programmers write C++ a lot.

~~~
tvon
I don't think that slide was meant to be taken literally, you can integrate
Objective-C with Swift.

------
hengheng
This slide deck takes 24 slides until they get their hands dirty, which is a
new record in my book.

~~~
seiji
It can be difficult to gauge presentation tone for completely unknown
audiences. If the audience for the presentation was mostly a group of
"corporate friends" with unknown common technical background, it probably went
well. If the audience was a bunch of unrelated HN people who want information
_now now now_, a meme every other slide is a bit tiresome.

(gratuitous self promotion): I'm starting a long-form intro-to-Swift ebook
series: [https://matt.sh/books](https://matt.sh/books) — no meme graphics,
guaranteed.

The first book was released yesterday and more are on the way!

------
picardo
I haven't seen it mentioned how you would do composition in Swift. I assume it
has a feature like Scala's traits –– hopefully with a better syntax? Does
anyone know?

~~~
krat0sprakhar
This might be helpful -
[https://leverich.github.io/swiftislikescala/#protocol](https://leverich.github.io/swiftislikescala/#protocol)

~~~
virtualwhys
Thanks for that, interesting comparison.

Extensive usage of var in the examples, that's not suggested best practice in
Scala, val is king, but I guess for one-to-one comparison each language does
indeed express mutability similarly.

`return` is implicit if expression is the last in a block, so none of the
`return` statements on the Scala side are needed.

Pretty interesting grab bag of functionality, I'm seeing a lot of Scala, but
then bits of Python, Groovy, and Kotlin (extension methods) as well.

