Latest 1.2.0
License MIT @see LICENSE
Platforms ios 8.0, requires ARC
Authors ,


MIT License
Cocoapod compatible
Carthage compatible

Swift framework to configure and switch between multiple appearances of a UIButton, courtesy
of Talking Bibles International and Clay Smith


This framework adds a TBMultiAppearanceButton subclass of UIButton. This new class
allows for switching between multiple appearances of the button, each with its own full
complement of UIButton core properties. Each appearance may be configured for all
UIControlStates, including highlight and selected.

The possible appearances are cases of an enum that conforms to TBControlAppearanceType
with a raw type of Int. This enum can be used to control the appearance of multiple

enum PlayerButtonAppearance: Int, TBControlAppearanceType {
  case Play = 2
  case Pause = 3

Buttons must be programmatically created (at least for now), because the new button class
is generic. It must be specified with an appearance enum.

let button = TBMultiAppearanceButton<PlayerButtonAppearance>(frame: someFrame)

The properties of the button can now be configured for each of the appearances. Changing a
stored property will update the appearance if the specified appearance and state are
currently displayed.

button.setTitle("Play", forAppearance: .Play, andState: .Normal)
button.setTitle("Play", forAppearance: .Pause, andState: .Normal)

button.setBackgroundImage(UIImage.imageWithColor(UIColor.blueColor()), forAppearance: .Play, andState: .Normal)
button.setBackgroundImage(UIImage.imageWithColor(UIColor.lightGrayColor()), forAppearance: .Play, andState: .Normal)

The button can receive all the same messages as a UIButton. But the display properties of
the button will be overwritten by any stored appearance properties whenever the button
changes appearance or state. For this reason, it is advised to change the display
properties of the button only through the provided methods.

// Bad :(
// Will probably be overwritten
self.setTitle("Play", forState: .Normal)

// Good :)
button.setTitle("Play", forAppearance: .Play, andState: .Normal)

Switching between appearances is simple. The button will retain its current state, and any
properties configured for the appearance will be changed on the button.

// Select an appearance

// Later... select another appearance

This framework does not make any further changes to UIButton beyond adding on appearance
control. The subclassed button can be used without fear of cross-interaction any where a
built-in button could go.


This project is compatible with Cocoapods and Carthage. (These instructions assume that your
chosen method is already installed.)


Add pod 'TBMultiAppearanceButton' to your target. Since this is a Swift dynamic
framework, you must also tell Cocoapods to use_frameworks! instead of static libraries.

platform :ios, '8.0'

target 'YourProject' do
pod 'TBMultiAppearanceButton', '~> 1.2.0'


Add github "TalkingBibles/TBMultiAppearanceButton" ~> 1.2.0 to your Cartfile and run
carthage bootstrap. This builds an iOS framework.

> echo 'github "TalkingBibles/TBMultiAppearanceButton" ~> 1.0.0' >> Cartfile
> carthage bootstrap


See License

Latest podspec

    "name": "TBMultiAppearanceButton",
    "version": "1.2.0",
    "summary": "Swift framework to configure and switch between multiple appearances of a UIButton",
    "homepage": "",
    "license": {
        "type": "MIT",
        "text": "@see LICENSE"
    "authors": {
        "Talking Bibles International": "[email protected]",
        "Clay Smith": "[email protected]"
    "social_media_url": "",
    "source": {
        "git": "",
        "tag": "v1.2.0"
    "requires_arc": true,
    "xcconfig": {
    "platforms": {
        "ios": "8.0"
    "ios": {
        "source_files": "TBMultiAppearanceButton/*.{swift}",
        "frameworks": "UIKit"

Pin It on Pinterest

Share This