Developer Tools, iOS / OS X Swift Tool Belt, Part 5: Adding a Gradient UIButton A class derived from UIButton that will draw your button with a gradient background in Swift, using Xcode’s Interface Builder.