This post written on August 15, 2015 to be compatible with Xcode 6 and Swift 1.2 List comprehensions provide a concise way to create lists. You can accomplish list comprehension-like operations in Swift even though list comprehensions are not mentioned in the Swift language guide. Say you want to create a list of squares, like:…
Swift 2 – What’s new
Monday Apple announced Swift 2, and just about everything announced is an extremely welcome change. This post is a summary of Chris Lattner’s discussion in the WWDC video “What’s new in Swift”. Now, let’s run through them… Fundamentals enums can now be printed to the console and show the actually value instead of just (enum…
WWDC 2015 Developer Highlights
Today Apple announced watchOS, delivering a new native SDK for developers at WWDC 2015, a new version of Mac OS X known as OS X El Capitan. Mac OS X El Capitan Shaking the mouse makes the cursor appear larger to make it easier to find. Safari now includes “pinning” of tabs, which leaves permanent…
Open Source Swift – A Look At The Top Swift Repositories
Github, the most popular open source repository for open source software, offers a feature that let’s us view repositories by language. In this post, I want to dissect some of the most popular Swift repositories as of June 5th, 2015. So, let’s kick it off with the most starred Swift repository, Alamofire. Alamofire Alamofire is…
Function Currying in Swift
Function Currying in Swift The concept of currying is that instead of accepting multiple arguments, a function accepts only one, and returns a function which acepts the remaining arguments. The returned function will also accept only one argument, and returns another function. This process continues until all arguments are exhausted and we are left only…
Functional Programming in Swift
Thoughts on Functional Programming in Swift Like most of you, I have to use Objective-C at my day job. I could only craft my Swift skills at night. Swift is not a purely functional language. It can be use imperatively because all frameworks from Apple are written in Objective-C at the time of writing. However,…
Local Notifications in iOS 10 with Swift (Part 1)
This post has been updated for compatibility with XCode 8 and iOS 10 Local notifications are a simple way to display information to your user even when your app is in the background. They allow you to display an alert, play a sound or badge your app’s icon. Local notifications can be triggered at a scheduled time…
Local Notifications in iOS 9+ with Swift (Part 2)
This post has been updated for compatibility with XCode 8 and iOS 10 In part 1 of this series, we created a simple to-do list application that used local notifications to alert users when to-do items were overdue. This time, we’re going to build on that the project by enabling application icon badges to display the…
Fun with CAShapeLayer
CAShapeLayer is a specialized subclass of CALayer that draws itself using the shape you define via the path property. path is an instance of CGPath. We could leverage the convenient UIBezierPath APIs to create a path, and then retrieve the CGPath from it. Besides all the animatable properties inherited from CALayer, there are other animatable…
Swift 1.2 and Xcode 6 Beta 2 – The best update yet
The big news in the Swift community is the release of Swift 1.2, featuring some awesome features. Apple wrote about that a bit here, this was before they released Xcode 6.3 Beta 2, which came out today. But it contains most of the major language changes. Xcode 6.3 Beta 2 First of all, Xcode itself…