Swift Programming Language


Swift is an object oriented programming language from Apple targeted primarily for iOS, MacOSX, tvOS, watchOS application development. Swift is general purpose programming language and it is open source. It is modern, safe, fast.


  1. Syntax is very similar to many available scripting languages specially java script, so easy to adopt / learn.
  2. No pointers, no direct memory access
  3. ARC(Automatic reference counting) for memory management. It's simple and fast than garbage collector.
  4. Inter-operability, mix and match to work smoothly with older libraries already written in objective c and tested well.
  5. Modern features like closures (lambda/block) in other programming language.
  6. Open source programming language, available on MacOSX and Linux


Apple released Swift 1.0, in June 2014 and again version 2.0 in June 2015. Apple made swift open source in Dec 2014 while they made a dedicated website swift.org for open source community

Getting Started:

Since swift is primarily used on Apple platform like Mac OSX desktop applications, iOS application, watchOS, tvOS etc, so we will focus our tutorial in line with Xcode editor and MacOSX/iOS application development environment.

Xcode installation:

You can get Xcode from Apple's App Store.

  1. Launch App Store
  2. Search for Xcode on App Store
  3. Install Xcode

Xcode installation is very easy. App Store app does everything itself once you click on install button next to Xcode icon as shown in above screenshot. You might have to authenticate your download against your App Store credentials.

First Swift Program: "Hello World"

Launch Xcode on your mac.

Create new Xcode project.

Select command line project in MacOS X environment as shown in this pic.

Select the programming language as Swift and provide your "Product Name". Lets give Product Name as "HelloWorld" as shown in screenshot. Then go ahead and save the project on your mac [may be in Document folder or on Desktop].

On completion of last step, you will see there are some files created for you and in left column which is project navigator the files are listed. Click on main.m and you will see some code pre-written for you. At this point you are actually done with your first project "HelloWorld", the wizard has created it everything for you and now you have to Run the App to see the output.

See the output in console as shown in below screenshot.


  1. https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/index.html