A swift Introduction to Swift
slideshare.net
slideshare.net
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.
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.
PS: Much thanks for Big Nerd Ranch! Didn't know of these guys before.
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.
Probably your best bet is to do something like CodeSchool that has a long series of guided videos. But you have to know that after that, you will still lack a lot of knowledge, be working in a much more hostile environment, and have to put up with reading generally lower-quality documentation than in the Apple walled garden.
But we SHOULD expect this, sooner or later, otherwise Apple will be stuck to support Objective-C for long. The whole point of Swift is to make the entire development endeavor easier, thus Objective-C should eventually become deprecated. This can happen only when the APIs are rewritten from scratch in Swift, something that will take a lot of time.
(do not worry, even if Objective-C becomes deprecated, we should expect at least 5-10 years before it becomes completely outdated to the point that Apple drops it entirely)
You're presenting mainly the language, which makes senses but might be already ticking boxes with at least part of the audience here which is already familiar with Haskell, or Rust, or OCaml, etc.
So, it's great to see the features and syntax, but what would be great is use Swift to make a tour of the API for iOS newcomers :)
And in principle it can revolutionise the way scripting works in OSX. From the few test I've done, when it will be stable it will be a fast nice replacement for many of my python, sh and ruby scripts.
Moreover, I think that this can set the basis for a better and simpler concurrency model in iOS too. But we will see.
The only thing I find disappointing and error prone is the different passing behavior between structs and classes, but I assume that we will get used to it.
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.
Swift is great! Even with my exposure to various C+Objects syntaxes over the years, Objective C just makes my eyes hurt. I wrote a couple of iOS apps and I never got used to it. I just don’t care for it. It’s really just a matter of personal prefs, I think, because others really like Obj-C and I grant that it must be possible! ;)
The Swift syntax is airy and easy to read. I felt like I was breathing fresh air, if that makes any sense. I converted the SpriteKit walkthrough PDF examples to Swift from Obj-C as I went along. Very straightforward. There were a couple of things that took a few minutes to figure out, but it was all very logical. The Cocoa APIs seem to fit Swift nicely.
I am very happy about this new language. As someone else said above, its like a heavy weight has been lifted. It really is that affecting.
Having said that, Swift is not nearly as intimidating as Scala.
What would you recommend to someone just starting out in iOS, starting with Obj-c or diving straight into Swift?
http://www.bignerdranch.com/blog/ios-developers-need-to-know...
* 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.
If one is starting out today, I'd highly recommend digging into swift immediately.
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.
(gratuitous self promotion): I'm starting a long-form intro-to-Swift ebook series: https://matt.sh/books — no meme graphics, guaranteed.
The first book was released yesterday and more are on the way!
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.
Implementation is currently strictly based on single inheritance with open classes (through extension).