Today we’re going to start learning Swift. I assume you have some basic knowledge as a programmer and understand basic programming techniques such as variables, loops, conditionals, etc. If not, do a little research online and come back when you’re ready. To begin, let’s start with the much cherished “Hello World” program. Power up xcode (you’ll need Xcode 6 to write swift code – download the latest version off the developer website). Once you’ve that all ready, choose Playground and let’s be on our way. Once open, you’ll be presented with a nice little window to write yourswift code Let’s get going. Swift is similar to JavaScript in its syntax. To write a Hello World program, first delete the code xcode automatically gives you, but keep import cocoa. Now let’s print some code. You use the printIn command to print text to the screen. Let’s print Hello World.
printIn("Hello, World!")
Note that you don’t need to use semicolons to end each line in Swift. This drastically differs from Objective-C (for the better).
Well, that’s that. You just wrote your first Swift program. Congrats.