As many of you know Apple released a new programming language called Swift at WWDC conference last week. It created such a buzz around the Internet that the Swift iBook (html version) was downloaded 350,000 times on the first day! Since then there are many Swift meetups, Swift video tutorials, Swift blogs popping up all over the place.

So as soon as I was done with Salesforce Wear (Samsung Gear app specifically), I immediately started to sink my teeth into Swift. I have to tell you, it is fantastic. How good it’s going to be in the long run for bigger projects, only time will tell. But I think it would be easier for new comers than learning Objective-C because it takes inspiration from various scripting like JavaScript, Ruby and other modern OO languages like Closure that you are already familiar with.

Now, although Swift is syntactically different from Objective-C, it can co-exist with Objective-C projects and interact with each other. This is important because you don’t want to throw away all the Objective-C code just to start using Swift. So I thought it would be cool to create a short video that shows how to simply convert one of the Objective-C classes of the sample app that comes with Salesforce SDK’s forceiOS tool into Swift to give you an idea of how it works and feels.

In the [~12 mins] short video, you will learn:

  1. How to integrate Swift into an existing Objective-C project
  2. Get a taste of Swift programming language
  3. Compare Swift with Objective-C
  4. Deal with some of the quirkiness of early XCode 6 Beta


Source Code: You can download the source code here: https://github.com/rajaraodv/Swifty

Notes:
1. Swift needs Xcode6 beta 2 and iOS 8 beta iPhone simulator.
2. XCode6 needs latest Mavericks or Yosemite (iOS 8) operating system.
3. Be warned that XCode 6 is very flaky, especially when you want to use Swift in Objective-C projects.

If you have any questions, please contact me on Twitter: @rajaraodv

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS