Skip to content

Instantly share code, notes, and snippets.

@siemensikkema
Created February 12, 2016 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siemensikkema/7c2609b55cd66fcbee86 to your computer and use it in GitHub Desktop.
Save siemensikkema/7c2609b55cd66fcbee86 to your computer and use it in GitHub Desktop.
Themeable ViewController demonstration
import UIKit
protocol Themeable {
func applyTheme()
}
extension Themeable where Self: UIViewController {
func applyTheme() {
// beautiful!
navigationItem.leftBarButtonItem?.tintColor = .purpleColor()
}
}
class ThemedViewController: UIViewController, Themeable {
override func viewDidLoad() {
super.viewDidLoad()
applyTheme()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment