One of the issues you’ll notice when using Swift is that native key-value-observing is not available and only works with NSObject subclasses.
Swift is changing rapidly and a solution does appear to be on the roadmap for this issue. Until the solution arrives here’s a tutorial from Krzysztof Zablocki illustrating a nice technique for implementing observable properties completely using Swift. This technique uses generics and what’s really nice is that you can create the observable properties without affecting the rest of your code.
Back in February I mentioned an interesting library providing navigation bar buttons with slick animations between them.
Here’s a nice tutorial showing how to create a slick transition between two buttons using Core Graphics in Swift from Robert Böhnke.
Robert explains how he drew the different buttons, used Paint Code for automatically creating code from images for the trickier paths, and explains step by step how he animated each individual line stroke to achieve a “hamburger button” type effect.
Last week I mentioned an interesting component inspired by the Skype app’s bendable action sheets allowing you to create views that bend on movement.
Here’s a similar component from Victor Baro using Core Animation and UIKit Dynamics to make a “bendable” view inspired by the Skype app along with a tutorial.
There’s also some interesting examples included with VBFJellyView demonstrating how the view bends with finger movements when connected to a UIPanGestureRecognizer, using it to create a “button” that expands/contracts on press and release, adding gravity, and collisions.
Last week I mentioned a nice tutorial on creating a simple Candy Crush style game with Swift and Sprite Kit.
Here’s a tutorial from Yari D’areglia aimed to help Objective-C developers avoid issues when get starting with the Swift programming language.
Some of the topics covered include:
- Using extensions to keep your code clean
- Examples of the delegate, target-action, and singleton patterns
- Understanding optional values
- Using blocks (closures)
- Understanding unowned references
Previously I mentioned the excellent JSONModel library providing a number of nice features working with JSON data most notably that makes it easy to convert JSON data to Objective-C objects.
Here’s a tutorial submitted by JSONModel developer Marin Todorov that walks through the creation of a couple of simple apps utilizing JSONModel step-by-step.
In the tutorial some of the things you’ll learn are how to: