Created
February 12, 2016 18:56
-
-
Save siemensikkema/7c2609b55cd66fcbee86 to your computer and use it in GitHub Desktop.
Themeable ViewController demonstration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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