How to Dim the Background of a Popover on iOS

The design for a recent project called for the contents of the popover view to be emphasized prominently. Specifically, the design wanted all the views behind the popover to be dimmed.

By default, iOS will put a radial gradient around the popup to draw attention to it, but I needed something more. In this blog post, I’ll show you how you can dim not only the view behind the popover, but also the status and navigation bar. Read more on How to Dim the Background of a Popover on iOS…

UI Unit Testing in Your iOS Project

When you create a new project in Xcode, you’re given the option of including two types of tests: Unit Tests and UI Tests. But I’ve often wished that these two weren’t mutually exclusive.

There have been times when I’ve wanted to test UI components in isolation, but I wasn’t sure how feasible it was, or if it even made sense. A similar concept exists in some web frameworks (e.g. component integration tests in Ember or React), but I wanted to try it out in iOS. Read more on UI Unit Testing in Your iOS Project…

Swift Tool Belt, Part 5: Adding a Gradient UIButton

The fifth item in my Swift Tool Belt is a class derived from UIButton that will draw your button with a gradient background. It will also expose the colors of your gradient in the attributes inspector of Xcode and render the gradient button directly in your storyboard. Read more on Swift Tool Belt, Part 5: Adding a Gradient UIButton…

.NET Core, OSX, libcurl, and OpenSSL

.NET Core makes it convenient to develop and test C# code across platforms. On my current project, this means we can do much of our work on Macs without ever firing up a Windows VM.

Even the best abstraction layers occasionally leak, though. Here’s a story of an OSX-specific issue we encountered, what we learned, and how to resolve it. Read more on .NET Core, OSX, libcurl, and OpenSSL…

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…

Swift Tool Belt, Part 4: Extending UITableViewController

The fourth item in my Swift Tool Belt 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 Swift Tool Belt, Part 4: Extending UITableViewController…

Swift Tool Belt, Part 3: Extending UILabel

The third item in my Swift Tool Belt is 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 Swift Tool Belt, Part 3: Extending UILabel…

Swift Tool Belt, Part 2: Extending Date

The second 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 Swift Tool Belt, Part 2: Extending Date…

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 Swift Tool Belt, Part 1: Adding a Border, Corner Radius, and Shadow to a UIView with Interface Builder…