On a recent project, I had to add a gradient background to a UINavigationBar. At first, I thought it would be easy, but I soon discovered a problem when I rotated my device to landscape orientation and the gradient on the navigation bar did not resize.
The seventh item in my Swift Tool Belt is an extension for UIBarButtonItem. This extension will add a couple of inspectable properties to help you set accessibility properties from Xcode’s interface builder. They also add the ability to hide a bar button item.
The sixth item in my Swift Tool Belt is an extension for UIFont. This extension will easily convert your font to be bold or italic. It can be useful if you use scaled fonts but need a different look.
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.
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.
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 […]
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 […]
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.
Automated testing is an essential part of every development project we undertake at Atomic Object. In the past year, I have worked on multiple iOS applications in Swift. Here are four things I’ve discovered that make unit and integration testing more convenient and flexible.
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 […]