Apple’s Swift and My Highlights
Couple of months ago, I built a mini app using Objective C, it was simply a pain for me. Objective-C is a proper superset of C. C level language is okay for me but as far as I’ve seen it becomes very complicated while implementing Cocoa Touch classes with Objective C.
Excerpt from my old iOS app programmed with Objective C
Broadly speaking Swift will be significantly simpler to use and understand than Objective-C. Since my background is Ruby, Swift goes more familiar for me.
So from my perspective; learning and building something using Objective C is not a must anymore. Swift is cross compatible with Objective C, it can simply use Objective C libraries.
I started to work with Swift, after the first announcement, downloaded Apple’s official books and started practicing. Compared to Objective C, Swift is a very exciting and fun language.
Here is a sample of comparing “Closure” syntax between Swift and Objective C;
In Objective C
void (^completionBlock)(NSData *, NSError *) = ^(NSData *data, NSError *error) {/* … */}
In Swift
let completionBlock: (NSData, NSError) -> Void = { data, error in /* … */ }
Excerpt From: Apple Inc. “Using Swift with Cocoa and Objective-C.” iBooks. https://itunes.apple.com/tr/book/using-swift-cocoa-objective/id888894773?mt=11
However, basic level Objective C experience is required to create interoperability between Swift and Objective C. So for me it’s good to go.
In this write up, I’ll list my favorite tools and technologies to build something with Swift, simply it’s my journey.
Parse SDK
Parse automatically takes care of synchronizing your app’s data with the cloud via a REST API. At first I tried Parse with Angular application.
They have a simple and powerful infrastructure, it just amazed me.
https://github.com/ParsePlatform
Fabric
Fabric is a modular toolkit to manage application services provided by Twitter, such as Crashlytics (crash reporting), Twitter API (sign with Twitter, embed tweets) and MoPub (mobile ad exchange)
https://fabric.io/
Alamofire
Alamofire is an HTTP networking library written in Swift. Alamofire just simplifies HTTP operations.
https://github.com/Alamofire/Alamofire
Sleipnir
Sleipnir is a BDD-style framework for Swift. Sleipnir is highly inspired by Cedar. I think this framework is very similar to Ruby’s BDD approach rspec. Easy to use.
https://github.com/railsware/Sleipnir
Canvas
Canvas enables you to do animations in Xcode without code
http://canvaspod.io/
RAMAnimatedTabBarController
RAMAnimatedTabBarController is a Swift module for adding animation to tabbar items.
https://github.com/Ramotion/animated-tab-bar
RAMPaperSwitch
Swift subclass of the UISwitch which paints over the parent view with the onTintColor when the switch is turned on. https://github.com/Ramotion/paper-switch
Adaptive Tab Bar
AdaptiveController is a ‘Progressive Reduction’ Swift module for adding custom states to Native or Custom UI elements.
https://github.com/Ramotion/adaptive-tab-bar
I encourage everyone who are interested in building something with Swift because it is a familiar language and easy to learn.
Here are my steps;
I started with “Objective-C Programming: The Big Nerd Ranch Guide” by Aaron Hillegass, Mark Fenoglio. Highly recommended.
- Apple’s books from iBooks.
- There are tons of playgrounds available, dig them.
- DesignCode.io (thanks to @mengto)
- Udemy has beginner-intermediate level courses, watch them.
- Watch the Introduction to Swift video from Apple WWDC 2014.
Swift has a big community and it’s still rapidly growing. Already 18K repositories are available on Github.
I’m about to pre-launch my Swift apps, you can follow me for updates.
I’ll share pros/cons, experiences, good/bad practices.
Happy Swifting!