Swift tutorial for beginners Part 1
Developing iOS Apps Using Swift
So as you all may know, Apple just just announced Swift for iOS 8 (not Taylor Swift), which is kinda exciting since Swift looks so easy to learn! In this part of the tutorial I will only cover some simple aspects of the new way of coding iOS.
“Swift is a new programming language for iOS and OS X apps that builds on the best of C and Objective-C, without the constraints of C compatibility”
Excerpt From: Apple Inc. “The Swift Programming Language.” iBooks. https://itun.es/pt/jEUH0.l
First things first, make sure that you’ve download Xcode 6 from https://developer.apple.com/ and create a new project.
Make sure that you select “Swift” as coding language:
We will end up with something like
As you may see, this has nothing to due with objective-C, but at the same time the structure keeps the same for AppDelegate. Also we have lost the Header file (.h), and now we only have a single swift file.
Lets add a Root View Controller and see how it goes ☺
And finally, build!
Did I mention how easy it is now do manipulate Strings with Swift?
Also you may have noticed that now we have let and var, the difference between them is that let defines a constant and var defines an usual variable.
On the next part of this series we will learn how to define a class and we will create a simple app.
Meanwhile you can take a look at this awesome Cheat sheet from @rwenderlich
See you later!