Understanding UIAppearance Container Hierarchies

I recently had my first run-in with the UIAppearance infrastructure that has been built into iOS for, admittedly, a long time. Given my experience with CSS, I brought along some assumptions of how appearance(whenContainedInInstancesOf:) would probably work. Naturally, these assumptions were very wrong. Read more on Understanding UIAppearance Container Hierarchies…

My Swift Tool Belt (Part 4): Extending UITableViewController

The last post in my Swift Tool Belt series is an extension for UITableViewController. A UITableViewController is a view controller with a table view that takes up the entire screen. My extension provides a couple of methods to resize the header and footer of a table view. Read more on My Swift Tool Belt (Part 4): Extending UITableViewController…

My Swift Tool Belt (Part 3): Extending UILabel

The next items in my Swift Tool Belt series are a couple of extensions on UILabel. These extensions will allow easy access to modify the edge insets on a label (the extra padding all around the text). There’s also an extension to add a rotation transform to a label. All of these extensions will be IBDesignable and IBInspectable for easy modification from Xcode’s Interface Builder.
Read more on My Swift Tool Belt (Part 3): Extending UILabel…

My Swift Tool Belt, Part 2: Extending Date

The next item in my Swift Tool Belt is an extension on the Date class. The interface to the Date class in iOS is very powerful, but in my opinion, it is not very readable. Simple operations to add/remove time to a date can be several lines long. Many of my extensions help with the readability of the class. Read more on My Swift Tool Belt, Part 2: Extending Date…

My Swift Tool Belt, Part 1: Adding a Border, Corner Radius, and Shadow to a UIView with Interface Builder

During my iOS work, I’ve assembled a set of code that I bring with me on every iOS project. I’m not talking about large frameworks or CocoaPods here. These are smaller Swift extensions or control overrides that are applicable to many projects. I think of them as my tool belt.


Read more on My Swift Tool Belt, Part 1: Adding a Border, Corner Radius, and Shadow to a UIView with Interface Builder…

A UIStackView Hack for Stacking Child Views Compactly

Before I developed for iOS, I did a lot of Microsoft WPF programming. One of the layouts available on that platform was a WrapPanel.

Microsoft’s WrapPanel is similar to Apple’s UIStackView in that it arranges child elements into a single line that can be oriented horizontally or vertically. There are many differences, but the one I want to focus on is that a WrapPanel will space the content as close together as possible, and the size of the content is determined by its intrinsic content size. Read more on A UIStackView Hack for Stacking Child Views Compactly…

UIStackView Tricks: Proportional Custom UIViews with ‘Fill Proportionally’

In iOS 9, Apple introduced a very handy new UI concept: the UIStackView. Stack views help us quickly compose sequential “stacks” of views without Auto Layout. UIStackView offers a number of distribution and spacing options in Interface Builder. If you’re unfamiliar with UIStackView, I recommend reading “Exploring UIStackView Distribution Types” first.

In this post, I’ll describe how to use the Fill Proportionally option with any custom view while enjoying fine-grained control over the proportions themselves. Read more on UIStackView Tricks: Proportional Custom UIViews with ‘Fill Proportionally’…

Achieve Resolution Independence in Your iOS App Using SVGs

Having devices of varying sizes is great for allowing users to choose what is right for them, but supporting all those combinations of resolution and pixel density can be a hassle. Even if you develop all of your original artwork in some vector format, you typically have to export it in PNG format at various sizes and densities. Read more on Achieve Resolution Independence in Your iOS App Using SVGs…

How to Use UISearchController to Add Search Your UITableViews

This is a simple tutorial on how to use the new UISearchController to add search capability to your UITableViews. The UISearchController was introduced a couple years ago in iOS 8 to replace the now deprecated UISearchDisplayController. In the new search controller, it is easier to add search to your table views. As of Xcode 8.1, the UISearchController has not been added to Interface Builder, so you have to add it programmatically. Even still, it is pretty easy to work with. Read more on How to Use UISearchController to Add Search Your UITableViews…

Working with iOS Image Filters in Swift

I have always found image processing interesting and fun. However, despite having a decent amount of experience with it, I had never worked much with the tools for iOS. I decided to play around with them a bit, and to my delight, most of the iOS image processing libraries are incredibly simple to use. This topic has a lot of surface area, so I won’t be able to do it justice in a single post. However, this post should be enough to allow you to get started with image processing in iOS.
Read more on Working with iOS Image Filters in Swift…