Commit 3386efad by Daniel Dahan

development: Color is now a subclass of UIColor

parent 6840f013
...@@ -47,7 +47,7 @@ class ViewController: UIViewController { ...@@ -47,7 +47,7 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.white view.backgroundColor = .white
prepareMenuButton() prepareMenuButton()
prepareFavoriteButton() prepareFavoriteButton()
...@@ -56,23 +56,23 @@ class ViewController: UIViewController { ...@@ -56,23 +56,23 @@ class ViewController: UIViewController {
} }
private func prepareMenuButton() { private func prepareMenuButton() {
menuButton = IconButton(image: Icon.cm.menu, tintColor: Color.white) menuButton = IconButton(image: Icon.cm.menu, tintColor: .white)
} }
private func prepareFavoriteButton() { private func prepareFavoriteButton() {
favoriteButton = IconButton(image: Icon.favorite, tintColor: Color.white) favoriteButton = IconButton(image: Icon.favorite, tintColor: .white)
} }
private func prepareShareButton() { private func prepareShareButton() {
shareButton = IconButton(image: Icon.cm.share, tintColor: Color.white) shareButton = IconButton(image: Icon.cm.share, tintColor: .white)
} }
private func prepareBar() { private func prepareBar() {
bar = Bar(leftViews: [menuButton], rightViews: [favoriteButton, shareButton]) bar = Bar(leftViews: [menuButton], rightViews: [favoriteButton, shareButton])
bar.backgroundColor = Color.blue.base bar.backgroundColor = .blue.base
bar.contentView.cornerRadiusPreset = .cornerRadius1 bar.contentView.cornerRadiusPreset = .cornerRadius1
bar.contentView.backgroundColor = Color.blue.lighten3 bar.contentView.backgroundColor = .blue.lighten3
view.layout(bar).horizontally().center() view.layout(bar).horizontally().center()
} }
......
...@@ -39,6 +39,6 @@ class AppBottomNavigationController: BottomNavigationController { ...@@ -39,6 +39,6 @@ class AppBottomNavigationController: BottomNavigationController {
private func prepareTabBar() { private func prepareTabBar() {
tabBar.depthPreset = .none tabBar.depthPreset = .none
tabBar.dividerColor = Color.grey.lighten3 tabBar.dividerColor = .grey.lighten3
} }
} }
...@@ -39,12 +39,12 @@ class AudioViewController: UIViewController { ...@@ -39,12 +39,12 @@ class AudioViewController: UIViewController {
/// Prepare tabBarItem. /// Prepare tabBarItem.
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.image = Icon.cm.audioLibrary?.tintWithColor(color: Color.blueGrey.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.image = Icon.cm.audioLibrary?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.audioLibrary?.tintWithColor(color: Color.blue.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.selectedImage = Icon.cm.audioLibrary?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
} }
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.blue.base view.backgroundColor = .blue.base
} }
} }
...@@ -39,12 +39,12 @@ class PhotoViewController: UIViewController { ...@@ -39,12 +39,12 @@ class PhotoViewController: UIViewController {
/// Prepare tabBarItem. /// Prepare tabBarItem.
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.image = Icon.cm.photoCamera?.tintWithColor(color: Color.blueGrey.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.image = Icon.cm.photoCamera?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.photoCamera?.tintWithColor(color: Color.blue.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.selectedImage = Icon.cm.photoCamera?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
} }
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.red.base view.backgroundColor = .red.base
} }
} }
...@@ -39,12 +39,12 @@ class RemindersViewController: UIViewController { ...@@ -39,12 +39,12 @@ class RemindersViewController: UIViewController {
/// Prepare tabBarItem. /// Prepare tabBarItem.
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.image = Icon.cm.bell?.tintWithColor(color: Color.blueGrey.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.image = Icon.cm.bell?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.bell?.tintWithColor(color: Color.blue.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.selectedImage = Icon.cm.bell?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
} }
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.yellow.base view.backgroundColor = .yellow.base
} }
} }
...@@ -39,12 +39,12 @@ class SearchViewController: UIViewController { ...@@ -39,12 +39,12 @@ class SearchViewController: UIViewController {
/// Prepare tabBarItem. /// Prepare tabBarItem.
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.image = Icon.cm.search?.tintWithColor(color: Color.blueGrey.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.image = Icon.cm.search?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.search?.tintWithColor(color: Color.blue.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.selectedImage = Icon.cm.search?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
} }
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.blueGrey.base view.backgroundColor = .blueGrey.base
} }
} }
...@@ -39,12 +39,12 @@ class VideoViewController: UIViewController { ...@@ -39,12 +39,12 @@ class VideoViewController: UIViewController {
/// Prepare tabBarItem. /// Prepare tabBarItem.
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.image = Icon.cm.videocam?.tintWithColor(color: Color.blueGrey.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.image = Icon.cm.videocam?.tint(with: blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.videocam?.tintWithColor(color: Color.blue.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.selectedImage = Icon.cm.videocam?.tint(with: blue.base)?.withRenderingMode(.alwaysOriginal)
} }
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.green.base view.backgroundColor = green.base
} }
} }
...@@ -58,7 +58,7 @@ struct ButtonLayout { ...@@ -58,7 +58,7 @@ struct ButtonLayout {
class ViewController: UIViewController { class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.white view.backgroundColor = white
prepareFlatButton() prepareFlatButton()
prepareRaisedButton() prepareRaisedButton()
...@@ -76,8 +76,8 @@ class ViewController: UIViewController { ...@@ -76,8 +76,8 @@ class ViewController: UIViewController {
} }
private func prepareRaisedButton() { private func prepareRaisedButton() {
let button = RaisedButton(title: "Raised Button", titleColor: Color.white) let button = RaisedButton(title: "Raised Button", titleColor: white)
button.backgroundColor = Color.blue.base button.backgroundColor = blue.base
view.layout(button) view.layout(button)
.width(ButtonLayout.Raised.width) .width(ButtonLayout.Raised.width)
...@@ -86,7 +86,7 @@ class ViewController: UIViewController { ...@@ -86,7 +86,7 @@ class ViewController: UIViewController {
} }
private func prepareFabButton() { private func prepareFabButton() {
let button = FabButton(image: Icon.cm.add, tintColor: Color.white) let button = FabButton(image: Icon.cm.add, tintColor: white)
view.layout(button) view.layout(button)
.width(ButtonLayout.Fab.diameter) .width(ButtonLayout.Fab.diameter)
......
...@@ -42,11 +42,11 @@ class AppCaptureController: CaptureController { ...@@ -42,11 +42,11 @@ class AppCaptureController: CaptureController {
private func prepareToolbar() { private func prepareToolbar() {
toolbar.titleLabel.isHidden = true toolbar.titleLabel.isHidden = true
toolbar.titleLabel.textColor = Color.white toolbar.titleLabel.textColor = white
toolbar.detailLabel.isHidden = true toolbar.detailLabel.isHidden = true
toolbar.detail = "Recording" toolbar.detail = "Recording"
toolbar.detailLabel.textColor = Color.red.accent1 toolbar.detailLabel.textColor = red.accent1
toolbar.leftViews = [switchCamerasButton] toolbar.leftViews = [switchCamerasButton]
toolbar.rightViews = [flashButton] toolbar.rightViews = [flashButton]
...@@ -55,8 +55,8 @@ class AppCaptureController: CaptureController { ...@@ -55,8 +55,8 @@ class AppCaptureController: CaptureController {
private func prepareCaptureButton() { private func prepareCaptureButton() {
captureButton.width = 72 captureButton.width = 72
captureButton.height = 72 captureButton.height = 72
captureButton.backgroundColor = Color.red.darken1.withAlphaComponent(0.3) captureButton.backgroundColor = red.darken1.withAlphaComponent(0.3)
captureButton.borderColor = Color.white captureButton.borderColor = white
captureButton.borderWidthPreset = .border3 captureButton.borderWidthPreset = .border3
captureButton.depthPreset = .none captureButton.depthPreset = .none
} }
......
...@@ -44,26 +44,26 @@ class ViewController: UIViewController { ...@@ -44,26 +44,26 @@ class ViewController: UIViewController {
} }
cc.capture.delegate = self cc.capture.delegate = self
cc.capture.captureSession.delegate = self cc.capture.session.delegate = self
view.layout(cc.capture).edges() view.layout(cc.capture).edges()
} }
} }
/// CaptureSessionDelegate. /// CaptureSessionDelegate.
extension ViewController: CaptureSessionDelegate { extension ViewController: CaptureSessionDelegate {
public func captureSessionFailedWithError(captureSession: CaptureSession, error: Error) { public func sessionFailedWithError(session: CaptureSession, error: Error) {
print(error) print(error)
} }
public func captureSessionStillImageAsynchronously(captureSession: CaptureSession, image: UIImage) { public func sessionStillImageAsynchronously(session: CaptureSession, image: UIImage) {
print("captureStillImageAsynchronously") print("captureStillImageAsynchronously")
} }
public func captureSessionCreateMovieFileFailedWithError(captureSession: CaptureSession, error: Error) { public func sessionCreateMovieFileFailedWithError(session: CaptureSession, error: Error) {
print("Capture Failed \(error)") print("Capture Failed \(error)")
} }
public func captureSessionDidStartRecordingToOutputFileAtURL(captureSession: CaptureSession, captureOutput: AVCaptureFileOutput, fileURL: NSURL, fromConnections connections: [Any]) { public func sessionDidStartRecordingToOutputFileAtURL(session: CaptureSession, captureOutput: AVCaptureFileOutput, fileURL: NSURL, fromConnections connections: [Any]) {
print("Capture Started Recording \(fileURL)") print("Capture Started Recording \(fileURL)")
// cameraButton.isHidden = true // cameraButton.isHidden = true
// videoButton.isHidden = true // videoButton.isHidden = true
...@@ -71,7 +71,7 @@ extension ViewController: CaptureSessionDelegate { ...@@ -71,7 +71,7 @@ extension ViewController: CaptureSessionDelegate {
// flashButton.isHidden = true // flashButton.isHidden = true
} }
public func captureSessionDidFinishRecordingToOutputFileAtURL(captureSession: CaptureSession, captureOutput: AVCaptureFileOutput, outputFileURL: NSURL, fromConnections connections: [Any], error: Error!) { public func sessionDidFinishRecordingToOutputFileAtURL(session: CaptureSession, captureOutput: AVCaptureFileOutput, outputFileURL: NSURL, fromConnections connections: [Any], error: Error!) {
print("Capture Stopped Recording \(outputFileURL)") print("Capture Stopped Recording \(outputFileURL)")
// cameraButton.isHidden = false // cameraButton.isHidden = false
// videoButton.isHidden = false // videoButton.isHidden = false
...@@ -94,17 +94,17 @@ extension ViewController: CaptureSessionDelegate { ...@@ -94,17 +94,17 @@ extension ViewController: CaptureSessionDelegate {
// toolbar.detailLabel.isHidden = true // toolbar.detailLabel.isHidden = true
} }
public func captureSessionWillSwitchCameras(captureSession: CaptureSession, position: AVCaptureDevicePosition) { public func sessionWillSwitchCameras(session: CaptureSession, position: AVCaptureDevicePosition) {
// ... do something // ... do something
} }
public func captureSessionDidSwitchCameras(captureSession: CaptureSession, position: AVCaptureDevicePosition) { public func sessionDidSwitchCameras(session: CaptureSession, position: AVCaptureDevicePosition) {
// if .back == position { // if .back == position {
// capture.captureSession.flashMode = .auto // capture.session.flashMode = .auto
// flashButton.image = UIImage(named: "ic_flash_auto_white") // flashButton.image = UIImage(named: "ic_flash_auto_white")
// switchCamerasButton.image = UIImage(named: "ic_camera_front_white") // switchCamerasButton.image = UIImage(named: "ic_camera_front_white")
// } else { // } else {
// capture.captureSession.flashMode = .off // capture.session.flashMode = .off
// flashButton.image = UIImage(named: "ic_flash_off_white") // flashButton.image = UIImage(named: "ic_flash_off_white")
// switchCamerasButton.image = UIImage(named: "ic_camera_rear_white") // switchCamerasButton.image = UIImage(named: "ic_camera_rear_white")
// } // }
...@@ -114,7 +114,7 @@ extension ViewController: CaptureSessionDelegate { ...@@ -114,7 +114,7 @@ extension ViewController: CaptureSessionDelegate {
/// CaptureDelegate. /// CaptureDelegate.
extension ViewController: CaptureDelegate { extension ViewController: CaptureDelegate {
public func captureDidPressFlashButton(capture: Capture, button: UIButton) { public func captureDidPressFlashButton(capture: Capture, button: UIButton) {
// guard .back == capture.captureSession.position else { // guard .back == capture.session.position else {
// return // return
// } // }
// //
...@@ -122,25 +122,25 @@ extension ViewController: CaptureDelegate { ...@@ -122,25 +122,25 @@ extension ViewController: CaptureDelegate {
// return // return
// } // }
// //
// switch capture.captureSession.flashMode { // switch capture.session.flashMode {
// case .off: // case .off:
// b.image = UIImage(named: "ic_flash_on_white") // b.image = UIImage(named: "ic_flash_on_white")
// capture.captureSession.flashMode = .on // capture.session.flashMode = .on
// case .on: // case .on:
// b.image = UIImage(named: "ic_flash_auto_white") // b.image = UIImage(named: "ic_flash_auto_white")
// capture.captureSession.flashMode = .auto // capture.session.flashMode = .auto
// case .auto: // case .auto:
// b.image = UIImage(named: "ic_flash_off_white") // b.image = UIImage(named: "ic_flash_off_white")
// capture.captureSession.flashMode = .off // capture.session.flashMode = .off
// } // }
} }
public func captureDidPressCameraButton(capture: Capture, button: UIButton) { public func captureDidPressCameraButton(capture: Capture, button: UIButton) {
// captureButton.backgroundColor = Color.blue.darken1.withAlphaComponent(0.3) // captureButton.backgroundColor = blue.darken1.withAlphaComponent(0.3)
} }
public func captureDidPressVideoButton(capture: Capture, button: UIButton) { public func captureDidPressVideoButton(capture: Capture, button: UIButton) {
// captureButton.backgroundColor = Color.red.darken1.withAlphaComponent(0.3) // captureButton.backgroundColor = red.darken1.withAlphaComponent(0.3)
} }
public func captureDidPressCaptureButton(capture: Capture, button: UIButton) { public func captureDidPressCaptureButton(capture: Capture, button: UIButton) {
......
...@@ -50,7 +50,7 @@ class ViewController: UIViewController { ...@@ -50,7 +50,7 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = grey.lighten5
prepareDateFormatter() prepareDateFormatter()
prepareDateLabel() prepareDateLabel()
...@@ -71,16 +71,16 @@ class ViewController: UIViewController { ...@@ -71,16 +71,16 @@ class ViewController: UIViewController {
private func prepareDateLabel() { private func prepareDateLabel() {
dateLabel = UILabel() dateLabel = UILabel()
dateLabel.font = RobotoFont.regular(with: 12) dateLabel.font = RobotoFont.regular(with: 12)
dateLabel.textColor = Color.blueGrey.base dateLabel.textColor = blueGrey.base
dateLabel.text = dateFormatter.string(from: Date.distantFuture) dateLabel.text = dateFormatter.string(from: Date.distantFuture)
} }
private func prepareFavoriteButton() { private func prepareFavoriteButton() {
favoriteButton = IconButton(image: Icon.favorite, tintColor: Color.red.base) favoriteButton = IconButton(image: Icon.favorite, tintColor: red.base)
} }
private func prepareMoreButton() { private func prepareMoreButton() {
moreButton = IconButton(image: Icon.cm.moreVertical, tintColor: Color.blueGrey.base) moreButton = IconButton(image: Icon.cm.moreVertical, tintColor: blueGrey.base)
} }
private func prepareAuthorView() { private func prepareAuthorView() {
...@@ -97,7 +97,7 @@ class ViewController: UIViewController { ...@@ -97,7 +97,7 @@ class ViewController: UIViewController {
toolbar.detail = "Build Beautiful Software" toolbar.detail = "Build Beautiful Software"
toolbar.detailLabel.textAlignment = .left toolbar.detailLabel.textAlignment = .left
toolbar.detailLabel.textColor = Color.blueGrey.base toolbar.detailLabel.textColor = blueGrey.base
} }
private func prepareContentView() { private func prepareContentView() {
......
...@@ -50,7 +50,7 @@ class ViewController: UIViewController { ...@@ -50,7 +50,7 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = grey.lighten5
prepareImageView() prepareImageView()
prepareFavoriteButton() prepareFavoriteButton()
...@@ -70,19 +70,19 @@ class ViewController: UIViewController { ...@@ -70,19 +70,19 @@ class ViewController: UIViewController {
} }
private func prepareFavoriteButton() { private func prepareFavoriteButton() {
favoriteButton = FlatButton(image: Icon.favorite, tintColor: Color.blueGrey.base) favoriteButton = FlatButton(image: Icon.favorite, tintColor: blueGrey.base)
} }
private func prepareShareButton() { private func prepareShareButton() {
shareButton = FlatButton(image: Icon.cm.share, tintColor: Color.blueGrey.base) shareButton = FlatButton(image: Icon.cm.share, tintColor: blueGrey.base)
} }
private func prepareStarButton() { private func prepareStarButton() {
starButton = FlatButton(image: Icon.cm.star, tintColor: Color.blueGrey.base) starButton = FlatButton(image: Icon.cm.star, tintColor: blueGrey.base)
} }
private func prepareMoreButton() { private func prepareMoreButton() {
moreButton = IconButton(image: Icon.cm.moreHorizontal, tintColor: Color.white) moreButton = IconButton(image: Icon.cm.moreHorizontal, tintColor: white)
} }
private func prepareToolbar() { private func prepareToolbar() {
...@@ -90,10 +90,10 @@ class ViewController: UIViewController { ...@@ -90,10 +90,10 @@ class ViewController: UIViewController {
toolbar.backgroundColor = nil toolbar.backgroundColor = nil
toolbar.title = "CosmicMind" toolbar.title = "CosmicMind"
toolbar.titleLabel.textColor = Color.white toolbar.titleLabel.textColor = white
toolbar.detail = "Build Beautiful Software" toolbar.detail = "Build Beautiful Software"
toolbar.detailLabel.textColor = Color.white toolbar.detailLabel.textColor = white
} }
private func prepareContentView() { private func prepareContentView() {
......
...@@ -37,7 +37,7 @@ class ViewController: UIViewController { ...@@ -37,7 +37,7 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.white view.backgroundColor = white
prepareLayer() prepareLayer()
} }
...@@ -50,7 +50,7 @@ class ViewController: UIViewController { ...@@ -50,7 +50,7 @@ class ViewController: UIViewController {
layer = Layer(frame: CGRect(x: (w - d) / 2, y: (h - d) / 2, width: d, height: d)) layer = Layer(frame: CGRect(x: (w - d) / 2, y: (h - d) / 2, width: d, height: d))
layer.depthPreset = .depth3 layer.depthPreset = .depth3
layer.shapePreset = .circle layer.shapePreset = .circle
layer.backgroundColor = Color.white.cgColor layer.backgroundColor = white.cgColor
layer.image = UIImage(named: "CosmicMind") layer.image = UIImage(named: "CosmicMind")
view.layer.addSublayer(layer) view.layer.addSublayer(layer)
......
...@@ -38,7 +38,7 @@ class AppMenuController: MenuController { ...@@ -38,7 +38,7 @@ class AppMenuController: MenuController {
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = grey.lighten5
prepareMenu() prepareMenu()
} }
......
...@@ -38,7 +38,7 @@ class RootViewController: UIViewController { ...@@ -38,7 +38,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = grey.lighten5
prepareAddButton() prepareAddButton()
prepareAudioLibraryButton() prepareAudioLibraryButton()
...@@ -69,14 +69,14 @@ class RootViewController: UIViewController { ...@@ -69,14 +69,14 @@ class RootViewController: UIViewController {
} }
private func prepareAddButton() { private func prepareAddButton() {
addButton = FabButton(image: Icon.cm.add, tintColor: Color.white) addButton = FabButton(image: Icon.cm.add, tintColor: white)
addButton.addTarget(self, action: #selector(handleToggleMenu), for: .touchUpInside) addButton.addTarget(self, action: #selector(handleToggleMenu), for: .touchUpInside)
} }
private func prepareAudioLibraryButton() { private func prepareAudioLibraryButton() {
audioLibraryMenuItem = MenuItem() audioLibraryMenuItem = MenuItem()
audioLibraryMenuItem.button.image = Icon.cm.audioLibrary audioLibraryMenuItem.button.image = Icon.cm.audioLibrary
audioLibraryMenuItem.button.backgroundColor = Color.green.base audioLibraryMenuItem.button.backgroundColor = green.base
audioLibraryMenuItem.button.depthPreset = .depth1 audioLibraryMenuItem.button.depthPreset = .depth1
audioLibraryMenuItem.title = "Audio Library" audioLibraryMenuItem.title = "Audio Library"
} }
...@@ -84,7 +84,7 @@ class RootViewController: UIViewController { ...@@ -84,7 +84,7 @@ class RootViewController: UIViewController {
private func prepareBellButton() { private func prepareBellButton() {
reminderMenuItem = MenuItem() reminderMenuItem = MenuItem()
reminderMenuItem.button.image = Icon.cm.bell reminderMenuItem.button.image = Icon.cm.bell
reminderMenuItem.button.backgroundColor = Color.blue.base reminderMenuItem.button.backgroundColor = blue.base
reminderMenuItem.title = "Reminders" reminderMenuItem.title = "Reminders"
} }
......
...@@ -35,7 +35,7 @@ class AppNavigationController: NavigationController { ...@@ -35,7 +35,7 @@ class AppNavigationController: NavigationController {
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
statusBarStyle = .lightContent statusBarStyle = .lightContent
(navigationBar as? NavigationBar)?.backgroundColor = Color.blue.base (navigationBar as? NavigationBar)?.backgroundColor = blue.base
} }
} }
...@@ -34,19 +34,19 @@ import Material ...@@ -34,19 +34,19 @@ import Material
class NextViewController: UIViewController { class NextViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.white view.backgroundColor = white
prepareNavigationItem() prepareNavigationItem()
} }
private func prepareNavigationItem() { private func prepareNavigationItem() {
navigationItem.title = "Title" navigationItem.title = "Title"
navigationItem.titleLabel.textColor = Color.white navigationItem.titleLabel.textColor = white
navigationItem.detail = "Detail Description" navigationItem.detail = "Detail Description"
navigationItem.detailLabel.textColor = Color.lightBlue.lighten5 navigationItem.detailLabel.textColor = lightBlue.lighten5
navigationItem.backButton.tintColor = Color.white navigationItem.backButton.tintColor = white
} }
} }
...@@ -42,7 +42,7 @@ class RootViewController: UIViewController { ...@@ -42,7 +42,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = grey.lighten5
prepareMenuButton() prepareMenuButton()
prepareStarButton() prepareStarButton()
...@@ -56,23 +56,23 @@ class RootViewController: UIViewController { ...@@ -56,23 +56,23 @@ class RootViewController: UIViewController {
} }
private func prepareMenuButton() { private func prepareMenuButton() {
menuButton = IconButton(image: Icon.cm.menu, tintColor: Color.white) menuButton = IconButton(image: Icon.cm.menu, tintColor: white)
} }
private func prepareStarButton() { private func prepareStarButton() {
starButton = IconButton(image: Icon.cm.star, tintColor: Color.white) starButton = IconButton(image: Icon.cm.star, tintColor: white)
} }
private func prepareSearchButton() { private func prepareSearchButton() {
searchButton = IconButton(image: Icon.cm.search, tintColor: Color.white) searchButton = IconButton(image: Icon.cm.search, tintColor: white)
} }
private func prepareNavigationItem() { private func prepareNavigationItem() {
navigationItem.title = "Material" navigationItem.title = "Material"
navigationItem.titleLabel.textColor = Color.white navigationItem.titleLabel.textColor = white
navigationItem.detail = "Build Beautiful Software" navigationItem.detail = "Build Beautiful Software"
navigationItem.detailLabel.textColor = Color.lightBlue.lighten5 navigationItem.detailLabel.textColor = lightBlue.lighten5
navigationItem.leftViews = [menuButton] navigationItem.leftViews = [menuButton]
navigationItem.rightViews = [starButton, searchButton] navigationItem.rightViews = [starButton, searchButton]
......
...@@ -36,7 +36,7 @@ class LeftViewController: UIViewController { ...@@ -36,7 +36,7 @@ class LeftViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.blue.base view.backgroundColor = blue.base
prepareTransitionButton() prepareTransitionButton()
} }
...@@ -55,7 +55,7 @@ class LeftViewController: UIViewController { ...@@ -55,7 +55,7 @@ class LeftViewController: UIViewController {
} }
private func prepareTransitionButton() { private func prepareTransitionButton() {
transitionButton = FlatButton(title: "Transition VC", titleColor: Color.white) transitionButton = FlatButton(title: "Transition VC", titleColor: white)
transitionButton.addTarget(self, action: #selector(handleTransitionButton), for: .touchUpInside) transitionButton.addTarget(self, action: #selector(handleTransitionButton), for: .touchUpInside)
view.layout(transitionButton).horizontally().center() view.layout(transitionButton).horizontally().center()
......
...@@ -36,7 +36,7 @@ class RightViewController: UIViewController { ...@@ -36,7 +36,7 @@ class RightViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.blue.base view.backgroundColor = blue.base
prepareRootButton() prepareRootButton()
} }
...@@ -55,7 +55,7 @@ class RightViewController: UIViewController { ...@@ -55,7 +55,7 @@ class RightViewController: UIViewController {
} }
private func prepareRootButton() { private func prepareRootButton() {
rootButton = FlatButton(title: "Root VC", titleColor: Color.white) rootButton = FlatButton(title: "Root VC", titleColor: white)
rootButton.addTarget(self, action: #selector(handleTransitionButton), for: .touchUpInside) rootButton.addTarget(self, action: #selector(handleTransitionButton), for: .touchUpInside)
view.layout(rootButton).horizontally().center() view.layout(rootButton).horizontally().center()
......
...@@ -34,7 +34,7 @@ import Material ...@@ -34,7 +34,7 @@ import Material
class RootViewController: UIViewController { class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.white view.backgroundColor = white
prepareToolbar() prepareToolbar()
} }
......
...@@ -34,7 +34,7 @@ import Material ...@@ -34,7 +34,7 @@ import Material
class TransitionedViewController: UIViewController { class TransitionedViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.purple.base view.backgroundColor = purple.base
prepareToolbar() prepareToolbar()
} }
......
...@@ -40,8 +40,8 @@ class AppPageTabBarController: PageTabBarController { ...@@ -40,8 +40,8 @@ class AppPageTabBarController: PageTabBarController {
} }
private func preparePageTabBar() { private func preparePageTabBar() {
pageTabBar.lineColor = Color.blueGrey.base pageTabBar.lineColor = blueGrey.base
pageTabBar.dividerColor = Color.blueGrey.lighten5 pageTabBar.dividerColor = blueGrey.lighten5
} }
} }
......
...@@ -44,12 +44,12 @@ class BlueViewController: UIViewController { ...@@ -44,12 +44,12 @@ class BlueViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.blue.base view.backgroundColor = blue.base
} }
private func preparePageTabBarItem() { private func preparePageTabBarItem() {
pageTabBarItem.title = "Blue" pageTabBarItem.title = "Blue"
pageTabBarItem.titleColor = Color.blueGrey.base pageTabBarItem.titleColor = blueGrey.base
} }
} }
...@@ -44,12 +44,12 @@ class GreenViewController: UIViewController { ...@@ -44,12 +44,12 @@ class GreenViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.green.base view.backgroundColor = green.base
} }
private func preparePageTabBarItem() { private func preparePageTabBarItem() {
pageTabBarItem.title = "Green" pageTabBarItem.title = "Green"
pageTabBarItem.titleColor = Color.blueGrey.base pageTabBarItem.titleColor = blueGrey.base
} }
} }
...@@ -44,12 +44,12 @@ class RedViewController: UIViewController { ...@@ -44,12 +44,12 @@ class RedViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.red.base view.backgroundColor = red.base
} }
private func preparePageTabBarItem() { private func preparePageTabBarItem() {
pageTabBarItem.title = "Red" pageTabBarItem.title = "Red"
pageTabBarItem.titleColor = Color.blueGrey.base pageTabBarItem.titleColor = blueGrey.base
} }
} }
...@@ -42,6 +42,6 @@ class AppToolbarController: ToolbarController { ...@@ -42,6 +42,6 @@ class AppToolbarController: ToolbarController {
private func prepareToolbar() { private func prepareToolbar() {
toolbar.title = "Photo Library" toolbar.title = "Photo Library"
toolbar.depthPreset = .none toolbar.depthPreset = .none
toolbar.dividerColor = Color.grey.lighten3 toolbar.dividerColor = grey.lighten3
} }
} }
...@@ -50,7 +50,7 @@ class PhotoLibraryCollectionReusableView: CollectionReusableView { ...@@ -50,7 +50,7 @@ class PhotoLibraryCollectionReusableView: CollectionReusableView {
toolbar.contentEdgeInsets.left = 16 toolbar.contentEdgeInsets.left = 16
toolbar.contentEdgeInsets.right = 16 toolbar.contentEdgeInsets.right = 16
toolbar.depthPreset = .none toolbar.depthPreset = .none
toolbar.dividerColor = Color.grey.lighten3 toolbar.dividerColor = grey.lighten3
layout(toolbar).edges() layout(toolbar).edges()
} }
} }
...@@ -73,7 +73,7 @@ class PhotoLibraryViewController: PhotoLibraryController { ...@@ -73,7 +73,7 @@ class PhotoLibraryViewController: PhotoLibraryController {
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = grey.lighten5
prepareCollectionView() prepareCollectionView()
...@@ -141,7 +141,7 @@ class PhotoLibraryViewController: PhotoLibraryController { ...@@ -141,7 +141,7 @@ class PhotoLibraryViewController: PhotoLibraryController {
layout.sectionHeadersPinToVisibleBounds = true layout.sectionHeadersPinToVisibleBounds = true
collectionView = PhotoLibraryCollectionView(frame: .zero, collectionViewLayout: layout) collectionView = PhotoLibraryCollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.backgroundColor = Color.clear collectionView.backgroundColor = clear
collectionView.delegate = self collectionView.delegate = self
collectionView.dataSource = self collectionView.dataSource = self
view.layout(collectionView).edges() view.layout(collectionView).edges()
......
...@@ -51,7 +51,7 @@ class ViewController: UIViewController { ...@@ -51,7 +51,7 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = grey.lighten5
preparePresenterView() preparePresenterView()
prepareDateFormatter() prepareDateFormatter()
...@@ -79,21 +79,21 @@ class ViewController: UIViewController { ...@@ -79,21 +79,21 @@ class ViewController: UIViewController {
private func prepareDateLabel() { private func prepareDateLabel() {
dateLabel = UILabel() dateLabel = UILabel()
dateLabel.font = RobotoFont.regular(with: 12) dateLabel.font = RobotoFont.regular(with: 12)
dateLabel.textColor = Color.blueGrey.base dateLabel.textColor = blueGrey.base
dateLabel.textAlignment = .center dateLabel.textAlignment = .center
dateLabel.text = dateFormatter.string(from: Date.distantFuture) dateLabel.text = dateFormatter.string(from: Date.distantFuture)
} }
private func prepareFavoriteButton() { private func prepareFavoriteButton() {
favoriteButton = IconButton(image: Icon.favorite, tintColor: Color.red.base) favoriteButton = IconButton(image: Icon.favorite, tintColor: red.base)
} }
private func prepareShareButton() { private func prepareShareButton() {
shareButton = IconButton(image: Icon.cm.share, tintColor: Color.blueGrey.base) shareButton = IconButton(image: Icon.cm.share, tintColor: blueGrey.base)
} }
private func prepareMoreButton() { private func prepareMoreButton() {
moreButton = IconButton(image: Icon.cm.moreHorizontal, tintColor: Color.blueGrey.base) moreButton = IconButton(image: Icon.cm.moreHorizontal, tintColor: blueGrey.base)
} }
private func prepareToolbar() { private func prepareToolbar() {
...@@ -104,7 +104,7 @@ class ViewController: UIViewController { ...@@ -104,7 +104,7 @@ class ViewController: UIViewController {
toolbar.detail = "Build Beautiful Software" toolbar.detail = "Build Beautiful Software"
toolbar.detailLabel.textAlignment = .left toolbar.detailLabel.textAlignment = .left
toolbar.detailLabel.textColor = Color.blueGrey.base toolbar.detailLabel.textColor = blueGrey.base
} }
private func prepareContentView() { private func prepareContentView() {
......
...@@ -37,7 +37,7 @@ class RootViewController: UIViewController { ...@@ -37,7 +37,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten1 view.backgroundColor = grey.lighten1
} }
open override func viewWillAppear(_ animated: Bool) { open override func viewWillAppear(_ animated: Bool) {
......
...@@ -36,7 +36,7 @@ class RootViewController: UIViewController { ...@@ -36,7 +36,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = grey.lighten5
} }
open override func viewDidAppear(_ animated: Bool) { open override func viewDidAppear(_ animated: Bool) {
...@@ -49,7 +49,7 @@ class RootViewController: UIViewController { ...@@ -49,7 +49,7 @@ class RootViewController: UIViewController {
} }
private func prepareUndoButton() { private func prepareUndoButton() {
undoButton = FlatButton(title: "Undo", titleColor: Color.yellow.base) undoButton = FlatButton(title: "Undo", titleColor: yellow.base)
undoButton.pulseAnimation = .backing undoButton.pulseAnimation = .backing
undoButton.titleLabel?.font = snackbarController?.snackbar.textLabel.font undoButton.titleLabel?.font = snackbarController?.snackbar.textLabel.font
} }
......
...@@ -34,7 +34,7 @@ import Material ...@@ -34,7 +34,7 @@ import Material
class RootViewController: UIViewController { class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten1 view.backgroundColor = grey.lighten1
} }
} }
...@@ -35,7 +35,7 @@ class ViewController: UIViewController { ...@@ -35,7 +35,7 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.white view.backgroundColor = white
prepareSwitch() prepareSwitch()
} }
......
...@@ -40,22 +40,22 @@ class ViewController: UIViewController { ...@@ -40,22 +40,22 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.white view.backgroundColor = white
prepareButtons() prepareButtons()
prepareTabBar() prepareTabBar()
} }
private func prepareButtons() { private func prepareButtons() {
let btn1 = FlatButton(title: "Library", titleColor: Color.blueGrey.base) let btn1 = FlatButton(title: "Library", titleColor: blueGrey.base)
btn1.pulseAnimation = .none btn1.pulseAnimation = .none
buttons.append(btn1) buttons.append(btn1)
let btn2 = FlatButton(title: "Photo", titleColor: Color.blueGrey.base) let btn2 = FlatButton(title: "Photo", titleColor: blueGrey.base)
btn2.pulseAnimation = .none btn2.pulseAnimation = .none
buttons.append(btn2) buttons.append(btn2)
let btn3 = FlatButton(title: "Video", titleColor: Color.blueGrey.base) let btn3 = FlatButton(title: "Video", titleColor: blueGrey.base)
btn3.pulseAnimation = .none btn3.pulseAnimation = .none
buttons.append(btn3) buttons.append(btn3)
} }
...@@ -63,13 +63,13 @@ class ViewController: UIViewController { ...@@ -63,13 +63,13 @@ class ViewController: UIViewController {
private func prepareTabBar() { private func prepareTabBar() {
tabBar = TabBar() tabBar = TabBar()
tabBar.dividerColor = Color.grey.lighten3 tabBar.dividerColor = grey.lighten3
tabBar.dividerAlignment = .top tabBar.dividerAlignment = .top
tabBar.lineColor = Color.blue.base tabBar.lineColor = blue.base
tabBar.lineAlignment = .top tabBar.lineAlignment = .top
tabBar.backgroundColor = Color.grey.lighten5 tabBar.backgroundColor = grey.lighten5
tabBar.buttons = buttons tabBar.buttons = buttons
view.layout(tabBar).horizontally().bottom() view.layout(tabBar).horizontally().bottom()
......
...@@ -38,7 +38,7 @@ class ViewController: UIViewController { ...@@ -38,7 +38,7 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.white view.backgroundColor = white
prepareNameField() prepareNameField()
prepareEmailField() prepareEmailField()
...@@ -53,7 +53,7 @@ class ViewController: UIViewController { ...@@ -53,7 +53,7 @@ class ViewController: UIViewController {
/// Prepares the resign responder button. /// Prepares the resign responder button.
private func prepareResignResponderButton() { private func prepareResignResponderButton() {
let btn = RaisedButton(title: "Resign", titleColor: Color.blue.base) let btn = RaisedButton(title: "Resign", titleColor: blue.base)
btn.addTarget(self, action: #selector(handleResignResponderButton(button:)), for: .touchUpInside) btn.addTarget(self, action: #selector(handleResignResponderButton(button:)), for: .touchUpInside)
view.layout(btn).width(100).height(50).bottom(24).right(24) view.layout(btn).width(100).height(50).bottom(24).right(24)
...@@ -87,9 +87,9 @@ class ViewController: UIViewController { ...@@ -87,9 +87,9 @@ class ViewController: UIViewController {
emailField.isClearIconButtonEnabled = true emailField.isClearIconButtonEnabled = true
emailField.delegate = self emailField.delegate = self
emailField.placeholderNormalColor = Color.amber.darken4 emailField.placeholderNormalColor = amber.darken4
emailField.placeholderActiveColor = Color.pink.base emailField.placeholderActiveColor = pink.base
emailField.dividerNormalColor = Color.cyan.base emailField.dividerNormalColor = cyan.base
view.addSubview(emailField) view.addSubview(emailField)
} }
...@@ -102,7 +102,7 @@ class ViewController: UIViewController { ...@@ -102,7 +102,7 @@ class ViewController: UIViewController {
passwordField.isVisibilityIconButtonEnabled = true passwordField.isVisibilityIconButtonEnabled = true
// Setting the visibilityIconButton color. // Setting the visibilityIconButton color.
passwordField.visibilityIconButton?.tintColor = Color.green.base.withAlphaComponent(passwordField.isSecureTextEntry ? 0.38 : 0.54) passwordField.visibilityIconButton?.tintColor = green.base.withAlphaComponent(passwordField.isSecureTextEntry ? 0.38 : 0.54)
// Size the TextField to the maximum width, less 40 pixels on either side // Size the TextField to the maximum width, less 40 pixels on either side
// with a top margin of 200 pixels. // with a top margin of 200 pixels.
......
...@@ -38,7 +38,7 @@ class RootViewController: UIViewController { ...@@ -38,7 +38,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.white view.backgroundColor = white
} }
open override func viewWillAppear(_ animated: Bool) { open override func viewWillAppear(_ animated: Bool) {
......
...@@ -37,7 +37,7 @@ class ViewController: UIViewController { ...@@ -37,7 +37,7 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.white view.backgroundColor = white
prepareLogo() prepareLogo()
} }
...@@ -48,7 +48,7 @@ class ViewController: UIViewController { ...@@ -48,7 +48,7 @@ class ViewController: UIViewController {
logo = View() logo = View()
logo.depthPreset = .depth3 logo.depthPreset = .depth3
logo.shapePreset = .circle logo.shapePreset = .circle
logo.backgroundColor = Color.white logo.backgroundColor = white
logo.image = UIImage(named: "CosmicMind") logo.image = UIImage(named: "CosmicMind")
view.layout(logo).width(d).height(d).center() view.layout(logo).width(d).height(d).center()
......
...@@ -39,6 +39,6 @@ class AppBottomNavigationController: BottomNavigationController { ...@@ -39,6 +39,6 @@ class AppBottomNavigationController: BottomNavigationController {
private func prepareTabBar() { private func prepareTabBar() {
tabBar.depthPreset = .none tabBar.depthPreset = .none
tabBar.divider.color = Color.grey.lighten3 tabBar.dividerColor = .grey.lighten3
} }
} }
...@@ -39,12 +39,12 @@ class AudioViewController: UIViewController { ...@@ -39,12 +39,12 @@ class AudioViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.blue.base view.backgroundColor = .blue.base
} }
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.title = nil tabBarItem.title = nil
tabBarItem.image = Icon.cm.audioLibrary?.tintWithColor(color: Color.blueGrey.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.image = Icon.cm.audioLibrary?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.audioLibrary?.tintWithColor(color: Color.blue.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.selectedImage = Icon.cm.audioLibrary?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
} }
} }
...@@ -39,12 +39,12 @@ class PhotoViewController: UIViewController { ...@@ -39,12 +39,12 @@ class PhotoViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.red.base view.backgroundColor = .red.base
} }
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.title = nil tabBarItem.title = nil
tabBarItem.image = Icon.cm.photoCamera?.tintWithColor(color: Color.blueGrey.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.image = Icon.cm.photoCamera?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.photoCamera?.tintWithColor(color: Color.blue.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.selectedImage = Icon.cm.photoCamera?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
} }
} }
...@@ -39,12 +39,12 @@ class RemindersViewController: UIViewController { ...@@ -39,12 +39,12 @@ class RemindersViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.yellow.base view.backgroundColor = .yellow.base
} }
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.title = nil tabBarItem.title = nil
tabBarItem.image = Icon.cm.bell?.tintWithColor(color: Color.blueGrey.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.image = Icon.cm.bell?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.bell?.tintWithColor(color: Color.blue.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.selectedImage = Icon.cm.bell?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
} }
} }
...@@ -39,12 +39,12 @@ class SearchViewController: UIViewController { ...@@ -39,12 +39,12 @@ class SearchViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.blueGrey.base view.backgroundColor = .blueGrey.base
} }
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.title = nil tabBarItem.title = nil
tabBarItem.image = Icon.cm.search?.tintWithColor(color: Color.blueGrey.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.image = Icon.cm.search?.tint(with: .blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.search?.tintWithColor(color: Color.blue.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.selectedImage = Icon.cm.search?.tint(with: .blue.base)?.withRenderingMode(.alwaysOriginal)
} }
} }
...@@ -39,12 +39,12 @@ class VideoViewController: UIViewController { ...@@ -39,12 +39,12 @@ class VideoViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.green.base view.backgroundColor = green.base
} }
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.title = nil tabBarItem.title = nil
tabBarItem.image = Icon.cm.videocam?.tintWithColor(color: Color.blueGrey.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.image = Icon.cm.videocam?.tint(with: blueGrey.base)?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = Icon.cm.videocam?.tintWithColor(color: Color.blue.base)?.withRenderingMode(.alwaysOriginal) tabBarItem.selectedImage = Icon.cm.videocam?.tint(with: blue.base)?.withRenderingMode(.alwaysOriginal)
} }
} }
...@@ -47,7 +47,7 @@ class ViewController: UIViewController { ...@@ -47,7 +47,7 @@ class ViewController: UIViewController {
private func prepareIconButton() { private func prepareIconButton() {
iconButton.image = Icon.search iconButton.image = Icon.search
iconButton.pulseColor = Color.blue.base iconButton.pulseColor = blue.base
} }
} }
......
...@@ -34,7 +34,7 @@ import Material ...@@ -34,7 +34,7 @@ import Material
class NextViewController: UIViewController { class NextViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.base view.backgroundColor = grey.base
prepareNavigationItem() prepareNavigationItem()
} }
...@@ -43,7 +43,7 @@ class NextViewController: UIViewController { ...@@ -43,7 +43,7 @@ class NextViewController: UIViewController {
navigationItem.title = "Title" navigationItem.title = "Title"
navigationItem.detail = "Detail Description" navigationItem.detail = "Detail Description"
navigationItem.backButton.tintColor = Color.blue.base navigationItem.backButton.tintColor = blue.base
} }
} }
...@@ -42,7 +42,7 @@ class RootViewController: UIViewController { ...@@ -42,7 +42,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten1 view.backgroundColor = grey.lighten1
prepareMenuButton() prepareMenuButton()
prepareStarButton() prepareStarButton()
......
...@@ -34,6 +34,6 @@ import Material ...@@ -34,6 +34,6 @@ import Material
class LeftViewController: UIViewController { class LeftViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.blue.base view.backgroundColor = blue.base
} }
} }
...@@ -34,6 +34,6 @@ import Material ...@@ -34,6 +34,6 @@ import Material
class RightViewController: UIViewController { class RightViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.blue.base view.backgroundColor = blue.base
} }
} }
...@@ -40,7 +40,7 @@ class AppPageTabBarController: PageTabBarController { ...@@ -40,7 +40,7 @@ class AppPageTabBarController: PageTabBarController {
} }
private func preparePageTabBar() { private func preparePageTabBar() {
pageTabBar.lineColor = Color.grey.darken1 pageTabBar.lineColor = grey.darken1
} }
} }
......
...@@ -44,12 +44,12 @@ class BlueViewController: UIViewController { ...@@ -44,12 +44,12 @@ class BlueViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.blue.base view.backgroundColor = blue.base
} }
private func preparePageTabBarItem() { private func preparePageTabBarItem() {
pageTabBarItem.title = "Blue" pageTabBarItem.title = "Blue"
pageTabBarItem.titleColor = Color.blueGrey.base pageTabBarItem.titleColor = blueGrey.base
} }
} }
...@@ -44,12 +44,12 @@ class GreenViewController: UIViewController { ...@@ -44,12 +44,12 @@ class GreenViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.green.base view.backgroundColor = green.base
} }
private func preparePageTabBarItem() { private func preparePageTabBarItem() {
pageTabBarItem.title = "Green" pageTabBarItem.title = "Green"
pageTabBarItem.titleColor = Color.blueGrey.base pageTabBarItem.titleColor = blueGrey.base
} }
} }
...@@ -44,12 +44,12 @@ class RedViewController: UIViewController { ...@@ -44,12 +44,12 @@ class RedViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.red.base view.backgroundColor = red.base
} }
private func preparePageTabBarItem() { private func preparePageTabBarItem() {
pageTabBarItem.title = "Red" pageTabBarItem.title = "Red"
pageTabBarItem.titleColor = Color.blueGrey.base pageTabBarItem.titleColor = blueGrey.base
} }
} }
...@@ -37,7 +37,7 @@ class RootViewController: UIViewController { ...@@ -37,7 +37,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten1 view.backgroundColor = grey.lighten1
} }
open override func viewWillAppear(_ animated: Bool) { open override func viewWillAppear(_ animated: Bool) {
......
...@@ -36,7 +36,7 @@ class RootViewController: UIViewController { ...@@ -36,7 +36,7 @@ class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = grey.lighten5
} }
open override func viewDidAppear(_ animated: Bool) { open override func viewDidAppear(_ animated: Bool) {
...@@ -49,7 +49,7 @@ class RootViewController: UIViewController { ...@@ -49,7 +49,7 @@ class RootViewController: UIViewController {
} }
private func prepareUndoButton() { private func prepareUndoButton() {
undoButton = FlatButton(title: "Undo", titleColor: Color.yellow.base) undoButton = FlatButton(title: "Undo", titleColor: yellow.base)
undoButton.pulseAnimation = .backing undoButton.pulseAnimation = .backing
undoButton.titleLabel?.font = snackbarController?.snackbar.textLabel.font undoButton.titleLabel?.font = snackbarController?.snackbar.textLabel.font
} }
......
...@@ -34,7 +34,7 @@ import Material ...@@ -34,7 +34,7 @@ import Material
class RootViewController: UIViewController { class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = grey.lighten5
} }
} }
...@@ -160,7 +160,7 @@ open class BottomNavigationController: UITabBarController, UITabBarControllerDel ...@@ -160,7 +160,7 @@ open class BottomNavigationController: UITabBarController, UITabBarControllerDel
private func prepareTabBar() { private func prepareTabBar() {
tabBar.depthPreset = .depth1 tabBar.depthPreset = .depth1
tabBar.dividerAlignment = .top tabBar.dividerAlignment = .top
let image = UIImage.imageWithColor(color: Color.clear, size: CGSize(width: 1, height: 1)) let image = UIImage.image(with: Color.clear, size: CGSize(width: 1, height: 1))
tabBar.shadowImage = image tabBar.shadowImage = image
tabBar.backgroundImage = image tabBar.backgroundImage = image
tabBar.backgroundColor = Color.white tabBar.backgroundColor = Color.white
......
...@@ -41,7 +41,7 @@ open class BottomTabBar: UITabBar { ...@@ -41,7 +41,7 @@ open class BottomTabBar: UITabBar {
/// Automatically aligns the BottomNavigationBar to the superview. /// Automatically aligns the BottomNavigationBar to the superview.
open var isAlignedToParentAutomatically = true open var isAlignedToParentAutomatically = true
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's background
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
didSet { didSet {
...@@ -127,8 +127,8 @@ open class BottomTabBar: UITabBar { ...@@ -127,8 +127,8 @@ open class BottomTabBar: UITabBar {
depthPreset = .depth1 depthPreset = .depth1
dividerAlignment = .top dividerAlignment = .top
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
backgroundColor = Color.white backgroundColor = .white
let image = UIImage.imageWithColor(color: Color.clear, size: CGSize(width: 1, height: 1)) let image = UIImage.image(with: .clear, size: CGSize(width: 1, height: 1))
shadowImage = image shadowImage = image
backgroundImage = image backgroundImage = image
} }
......
...@@ -75,7 +75,7 @@ open class Button: UIButton { ...@@ -75,7 +75,7 @@ open class Button: UIButton {
} }
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's background
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
didSet { didSet {
...@@ -143,9 +143,9 @@ open class Button: UIButton { ...@@ -143,9 +143,9 @@ open class Button: UIButton {
} }
/** /**
A convenience initializer that acceps an image and tintColor. A convenience initializer that acceps an image and tint
- Parameter image: A UIImage. - Parameter image: A UIImage.
- Parameter tintColor: A UIColor. - Parameter tintColor: A UI
*/ */
public convenience init(image: UIImage?, tintColor: UIColor = Color.blue.base) { public convenience init(image: UIImage?, tintColor: UIColor = Color.blue.base) {
self.init() self.init()
...@@ -153,9 +153,9 @@ open class Button: UIButton { ...@@ -153,9 +153,9 @@ open class Button: UIButton {
} }
/** /**
A convenience initializer that acceps a title and titleColor. A convenience initializer that acceps a title and title
- Parameter title: A String. - Parameter title: A String.
- Parameter titleColor: A UIColor. - Parameter titleColor: A UI
*/ */
public convenience init(title: String?, titleColor: UIColor = Color.blue.base) { public convenience init(title: String?, titleColor: UIColor = Color.blue.base) {
self.init() self.init()
...@@ -252,9 +252,9 @@ open class Button: UIButton { ...@@ -252,9 +252,9 @@ open class Button: UIButton {
} }
/** /**
Prepares the Button with an image and tintColor. Prepares the Button with an image and tint
- Parameter image: A UIImage. - Parameter image: A UIImage.
- Parameter tintColor: A UIColor. - Parameter tintColor: A UI
*/ */
private func prepare(with image: UIImage?, tintColor: UIColor) { private func prepare(with image: UIImage?, tintColor: UIColor) {
self.image = image self.image = image
...@@ -263,9 +263,9 @@ open class Button: UIButton { ...@@ -263,9 +263,9 @@ open class Button: UIButton {
} }
/** /**
Prepares the Button with a title and titleColor. Prepares the Button with a title and title
- Parameter title: A String. - Parameter title: A String.
- Parameter titleColor: A UIColor. - Parameter titleColor: A UI
*/ */
private func prepare(with title: String?, titleColor: UIColor) { private func prepare(with title: String?, titleColor: UIColor) {
self.title = title self.title = title
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
*/ */
import UIKit import UIKit
import Material
extension UIViewController { extension UIViewController {
/** /**
...@@ -50,69 +49,59 @@ extension UIViewController { ...@@ -50,69 +49,59 @@ extension UIViewController {
} }
open class CaptureController: ToolbarController, CaptureDelegate, CaptureSessionDelegate { open class CaptureController: ToolbarController, CaptureDelegate, CaptureSessionDelegate {
/// A reference to the Capture instance.
open private(set) lazy var capture: Capture = Capture() open private(set) lazy var capture: Capture = Capture()
open private(set) var cameraButton: IconButton!
open private(set) var videoButton: IconButton!
open private(set) var switchCamerasButton: IconButton!
open private(set) var flashButton: IconButton!
open private(set) var captureButton: FabButton!
open override func prepare() { /// A reference to capture's cameraButton.
super.prepare() open var cameraButton: IconButton {
view.backgroundColor = Color.black return capture.cameraButton
display = .full
prepareToolbar()
prepareCaptureButton()
prepareCameraButton()
prepareVideoButton()
prepareSwitchCamerasButton()
prepareFlashButton()
prepareCapture()
} }
/// Prepares the Toolbar. /// A reference to capture's videoButton.
private func prepareToolbar() { open var videoButton: IconButton {
toolbar.backgroundColor = Color.clear return capture.videoButton
toolbar.depthPreset = .none
} }
/// Prepares the captureButton. /// A reference to capture's switchCamerasButton.
private func prepareCaptureButton() { open var switchCamerasButton: IconButton {
captureButton = FabButton() return capture.switchCamerasButton
capture.captureButton = captureButton
} }
/// Prepares the cameraButton. /// A reference to capture's flashButton.
private func prepareCameraButton() { open var flashButton: IconButton {
cameraButton = IconButton(image: Icon.cm.photoCamera, tintColor: Color.white) return capture.flashButton
capture.cameraButton = cameraButton
} }
/// Preapres the videoButton. /// A reference to capture's captureButton.
private func prepareVideoButton() { open var captureButton: FabButton {
videoButton = IconButton(image: Icon.cm.videocam, tintColor: Color.white) return capture.captureButton
capture.videoButton = videoButton
} }
/// Prepares the switchCameraButton. /**
private func prepareSwitchCamerasButton() { Prepares the view instance when intialized. When subclassing,
switchCamerasButton = IconButton(image: UIImage(named: "ic_camera_front_white"), tintColor: Color.white) it is recommended to override the prepare method
capture.switchCamerasButton = switchCamerasButton to initialize property values and other setup operations.
The super.prepare method should always be called immediately
when subclassing.
*/
open override func prepare() {
super.prepare()
view.backgroundColor = .black
display = .full
prepareToolbar()
prepareCapture()
} }
/// Prepares the flashButton. /// Prepares the Toolbar.
private func prepareFlashButton() { private func prepareToolbar() {
flashButton = IconButton(image: UIImage(named: "ic_flash_auto_white"), tintColor: Color.white) toolbar.backgroundColor = .clear
capture.flashButton = flashButton toolbar.depthPreset = .none
capture.captureSession.flashMode = .auto
} }
/// Prepares capture. /// Prepares capture.
private func prepareCapture() { private func prepareCapture() {
capture.enableTapToFocus = true
capture.enableTapToExpose = true
capture.delegate = self capture.delegate = self
capture.captureSession.delegate = self capture.session.delegate = self
} }
} }
...@@ -157,7 +157,7 @@ open class CollectionReusableView: UICollectionReusableView { ...@@ -157,7 +157,7 @@ open class CollectionReusableView: UICollectionReusableView {
} }
/// A reference to EdgeInsets. /// A reference to EdgeInsets.
@IBInspectable open var contentInset: UIEdgeInsets { @IBInspectable open var contentEdgeInsets: UIEdgeInsets {
get { get {
return grid.contentEdgeInsets return grid.contentEdgeInsets
} }
...@@ -183,7 +183,7 @@ open class CollectionReusableView: UICollectionReusableView { ...@@ -183,7 +183,7 @@ open class CollectionReusableView: UICollectionReusableView {
} }
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's background
@IBInspectable open override var backgroundColor: UIColor? { @IBInspectable open override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.cgColor layer.backgroundColor = backgroundColor?.cgColor
......
...@@ -41,7 +41,7 @@ open class CollectionView: UICollectionView { ...@@ -41,7 +41,7 @@ open class CollectionView: UICollectionView {
} }
} }
open override var contentInset: UIEdgeInsets { open var contentEdgeInsets: EdgeInsets {
get { get {
return (collectionViewLayout as? CollectionViewLayout)!.contentEdgeInsets return (collectionViewLayout as? CollectionViewLayout)!.contentEdgeInsets
} }
...@@ -68,7 +68,8 @@ open class CollectionView: UICollectionView { ...@@ -68,7 +68,8 @@ open class CollectionView: UICollectionView {
} }
/// Spacing between items. /// Spacing between items.
@IBInspectable open var interimSpace: InterimSpace { @IBInspectable
open var interimSpace: InterimSpace {
get { get {
return (collectionViewLayout as? CollectionViewLayout)!.interimSpace return (collectionViewLayout as? CollectionViewLayout)!.interimSpace
} }
...@@ -119,7 +120,7 @@ open class CollectionView: UICollectionView { ...@@ -119,7 +120,7 @@ open class CollectionView: UICollectionView {
*/ */
open func prepare() { open func prepare() {
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
backgroundColor = Color.clear backgroundColor = .clear
contentInset = .zero contentEdgeInsets = .zero
} }
} }
...@@ -162,7 +162,7 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -162,7 +162,7 @@ open class CollectionViewCell: UICollectionViewCell {
/// A reference to EdgeInsets. /// A reference to EdgeInsets.
@IBInspectable @IBInspectable
open var contentInset: EdgeInsets { open var contentEdgeInsets: EdgeInsets {
get { get {
return contentView.grid.contentEdgeInsets return contentView.grid.contentEdgeInsets
} }
...@@ -189,7 +189,7 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -189,7 +189,7 @@ open class CollectionViewCell: UICollectionViewCell {
} }
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's background
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
didSet { didSet {
......
...@@ -56,30 +56,21 @@ public protocol ColorPalette { ...@@ -56,30 +56,21 @@ public protocol ColorPalette {
optional static var accent4: UIColor { get } optional static var accent4: UIColor { get }
} }
open class Color { open class Color: UIColor {
// clear
open static let clear = UIColor.clear
// white
open static let white = UIColor.white
// black
open static let black = UIColor.black
// dark text // dark text
open class darkText { open class darkText {
open static let primary = Color.black.withAlphaComponent(0.87) open static let primary = black.withAlphaComponent(0.87)
open static let secondary = Color.black.withAlphaComponent(0.54) open static let secondary = black.withAlphaComponent(0.54)
open static let others = Color.black.withAlphaComponent(0.38) open static let others = black.withAlphaComponent(0.38)
open static let dividers = Color.black.withAlphaComponent(0.12) open static let dividers = black.withAlphaComponent(0.12)
} }
// light text // light text
open class lightText { open class lightText {
open static let primary = Color.white open static let primary = white
open static let secondary = Color.white.withAlphaComponent(0.7) open static let secondary = white.withAlphaComponent(0.7)
open static let others = Color.white.withAlphaComponent(0.5) open static let others = white.withAlphaComponent(0.5)
open static let dividers = Color.white.withAlphaComponent(0.12) open static let dividers = white.withAlphaComponent(0.12)
} }
// red // red
......
...@@ -48,7 +48,7 @@ open class Divider { ...@@ -48,7 +48,7 @@ open class Divider {
/// A reference to the height. /// A reference to the height.
public var height: CGFloat public var height: CGFloat
/// A UIColor. /// A UI
open var color: UIColor? { open var color: UIColor? {
get { get {
return line?.backgroundColor return line?.backgroundColor
......
...@@ -43,8 +43,8 @@ open class FabButton: Button { ...@@ -43,8 +43,8 @@ open class FabButton: Button {
depthPreset = .depth1 depthPreset = .depth1
shapePreset = .circle shapePreset = .circle
pulseAnimation = .centerWithBacking pulseAnimation = .centerWithBacking
tintColor = Color.white tintColor = .white
pulseColor = Color.white pulseColor = .white
backgroundColor = Color.red.base backgroundColor = Color.red.base
} }
} }
...@@ -239,7 +239,7 @@ extension CALayer { ...@@ -239,7 +239,7 @@ extension CALayer {
} }
} }
/// A UIColor reference to the `backgroundColor.cgColor`. /// A UIColor reference to the `backgroundcgColor`.
open var color: UIColor? { open var color: UIColor? {
get { get {
return nil == backgroundColor ? nil : UIColor(cgColor: backgroundColor!) return nil == backgroundColor ? nil : UIColor(cgColor: backgroundColor!)
......
...@@ -100,7 +100,7 @@ extension UIImage { ...@@ -100,7 +100,7 @@ extension UIImage {
- Parameter color: The UIColor to create the image from. - Parameter color: The UIColor to create the image from.
- Returns: A UIImage that is the color passed in. - Returns: A UIImage that is the color passed in.
*/ */
open func tintWithColor(color: UIColor) -> UIImage? { open func tint(with color: UIColor) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(size, false, Device.scale) UIGraphicsBeginImageContextWithOptions(size, false, Device.scale)
guard let context = UIGraphicsGetCurrentContext() else { guard let context = UIGraphicsGetCurrentContext() else {
return nil return nil
...@@ -129,7 +129,7 @@ extension UIImage { ...@@ -129,7 +129,7 @@ extension UIImage {
- Parameter size: The size of the image to create. - Parameter size: The size of the image to create.
- Returns: A UIImage that is the color passed in. - Returns: A UIImage that is the color passed in.
*/ */
open class func imageWithColor(color: UIColor, size: CGSize) -> UIImage? { open class func image(with color: UIColor, size: CGSize) -> UIImage? {
let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height) let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
UIGraphicsBeginImageContextWithOptions(size, false, 0) UIGraphicsBeginImageContextWithOptions(size, false, 0)
color.setFill() color.setFill()
......
...@@ -110,7 +110,7 @@ extension UIView { ...@@ -110,7 +110,7 @@ extension UIView {
} }
} }
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadow
@IBInspectable @IBInspectable
open var shadowColor: UIColor? { open var shadowColor: UIColor? {
get { get {
......
...@@ -98,7 +98,7 @@ open class MenuItem: View { ...@@ -98,7 +98,7 @@ open class MenuItem: View {
private func prepareTitleLabel() { private func prepareTitleLabel() {
titleLabel.font = RobotoFont.regular(with: 14) titleLabel.font = RobotoFont.regular(with: 14)
titleLabel.textAlignment = .center titleLabel.textAlignment = .center
titleLabel.backgroundColor = Color.white titleLabel.backgroundColor = .white
titleLabel.depthPreset = button.depthPreset titleLabel.depthPreset = button.depthPreset
titleLabel.cornerRadiusPreset = .cornerRadius1 titleLabel.cornerRadiusPreset = .cornerRadius1
addSubview(titleLabel) addSubview(titleLabel)
......
...@@ -115,7 +115,7 @@ open class NavigationBar: UINavigationBar { ...@@ -115,7 +115,7 @@ open class NavigationBar: UINavigationBar {
} }
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's background
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
didSet { didSet {
...@@ -300,7 +300,7 @@ open class NavigationBar: UINavigationBar { ...@@ -300,7 +300,7 @@ open class NavigationBar: UINavigationBar {
The super.prepare method should always be called immediately The super.prepare method should always be called immediately
when subclassing. when subclassing.
*/ */
public func prepare() { open func prepare() {
barStyle = .black barStyle = .black
isTranslucent = false isTranslucent = false
depthPreset = .depth1 depthPreset = .depth1
...@@ -308,10 +308,10 @@ open class NavigationBar: UINavigationBar { ...@@ -308,10 +308,10 @@ open class NavigationBar: UINavigationBar {
contentEdgeInsetsPreset = .square1 contentEdgeInsetsPreset = .square1
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
backButtonImage = Icon.cm.arrowBack backButtonImage = Icon.cm.arrowBack
let image = UIImage.imageWithColor(color: Color.clear, size: CGSize(width: 1, height: 1)) let image = UIImage.image(with: .clear, size: CGSize(width: 1, height: 1))
shadowImage = image shadowImage = image
setBackgroundImage(image, for: .default) setBackgroundImage(image, for: .default)
backgroundColor = Color.white backgroundColor = .white
} }
/** /**
......
...@@ -112,7 +112,7 @@ open class NavigationController: UINavigationController { ...@@ -112,7 +112,7 @@ open class NavigationController: UINavigationController {
*/ */
open func prepare() { open func prepare() {
view.clipsToBounds = true view.clipsToBounds = true
view.backgroundColor = Color.white view.backgroundColor = .white
view.contentScaleFactor = Device.scale view.contentScaleFactor = Device.scale
// This ensures the panning gesture is available when going back between views. // This ensures the panning gesture is available when going back between views.
......
...@@ -975,7 +975,7 @@ open class NavigationDrawerController: RootController, UIGestureRecognizerDelega ...@@ -975,7 +975,7 @@ open class NavigationDrawerController: RootController, UIGestureRecognizerDelega
/// Prepares the contentViewController. /// Prepares the contentViewController.
private func prepareContentViewController() { private func prepareContentViewController() {
contentViewController.view.backgroundColor = Color.black contentViewController.view.backgroundColor = .black
prepare(viewController: contentViewController, withContainer: view) prepare(viewController: contentViewController, withContainer: view)
view.sendSubview(toBack: contentViewController.view) view.sendSubview(toBack: contentViewController.view)
} }
......
...@@ -48,7 +48,7 @@ open class PhotoLibraryController: UIViewController { ...@@ -48,7 +48,7 @@ open class PhotoLibraryController: UIViewController {
*/ */
open func prepare() { open func prepare() {
view.clipsToBounds = true view.clipsToBounds = true
view.backgroundColor = Color.white view.backgroundColor = .white
view.contentScaleFactor = Device.scale view.contentScaleFactor = Device.scale
preparePhotoLibrary() preparePhotoLibrary()
} }
......
...@@ -34,7 +34,7 @@ internal struct Pulse { ...@@ -34,7 +34,7 @@ internal struct Pulse {
/// An Array of layers. /// An Array of layers.
internal lazy var layers = [CAShapeLayer]() internal lazy var layers = [CAShapeLayer]()
/// A UIColor. /// A UI
internal var color = Color.blueGrey.base internal var color = Color.blueGrey.base
/// A reference to the PulseAnimation. /// A reference to the PulseAnimation.
......
...@@ -42,6 +42,6 @@ open class RaisedButton: Button { ...@@ -42,6 +42,6 @@ open class RaisedButton: Button {
super.prepare() super.prepare()
depthPreset = .depth1 depthPreset = .depth1
cornerRadiusPreset = .cornerRadius1 cornerRadiusPreset = .cornerRadius1
backgroundColor = Color.white backgroundColor = .white
} }
} }
...@@ -152,7 +152,7 @@ open class RootController: UIViewController { ...@@ -152,7 +152,7 @@ open class RootController: UIViewController {
*/ */
open func prepare() { open func prepare() {
view.clipsToBounds = true view.clipsToBounds = true
view.backgroundColor = Color.white view.backgroundColor = .white
view.contentScaleFactor = Device.scale view.contentScaleFactor = Device.scale
prepareRootViewController() prepareRootViewController()
} }
......
...@@ -74,17 +74,17 @@ open class SearchBar: Bar { ...@@ -74,17 +74,17 @@ open class SearchBar: Bar {
@IBInspectable @IBInspectable
open var placeholder: String? { open var placeholder: String? {
didSet { didSet {
if let v: String = placeholder { if let v = placeholder {
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor]) textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
} }
} }
} }
/// Placeholder textColor. /// Placeholder text
@IBInspectable @IBInspectable
open var placeholderColor = Color.darkText.others { open var placeholderColor = Color.darkText.others {
didSet { didSet {
if let v: String = placeholder { if let v = placeholder {
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor]) textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
} }
} }
......
...@@ -89,7 +89,7 @@ open class Switch: UIControl { ...@@ -89,7 +89,7 @@ open class Switch: UIControl {
/// Indicates if the animation should bounce. /// Indicates if the animation should bounce.
@IBInspectable @IBInspectable
public var bounceable = true { open var bounceable = true {
didSet { didSet {
bounceOffset = bounceable ? 3 : 0 bounceOffset = bounceable ? 3 : 0
} }
...@@ -97,7 +97,7 @@ open class Switch: UIControl { ...@@ -97,7 +97,7 @@ open class Switch: UIControl {
/// Button on color. /// Button on color.
@IBInspectable @IBInspectable
public var buttonOnColor = Color.clear { open var buttonOnColor = Color.clear {
didSet { didSet {
styleForState(state: switchState) styleForState(state: switchState)
} }
...@@ -105,7 +105,7 @@ open class Switch: UIControl { ...@@ -105,7 +105,7 @@ open class Switch: UIControl {
/// Button off color. /// Button off color.
@IBInspectable @IBInspectable
public var buttonOffColor = Color.clear { open var buttonOffColor = Color.clear {
didSet { didSet {
styleForState(state: switchState) styleForState(state: switchState)
} }
...@@ -113,7 +113,7 @@ open class Switch: UIControl { ...@@ -113,7 +113,7 @@ open class Switch: UIControl {
/// Track on color. /// Track on color.
@IBInspectable @IBInspectable
public var trackOnColor = Color.clear { open var trackOnColor = Color.clear {
didSet { didSet {
styleForState(state: switchState) styleForState(state: switchState)
} }
...@@ -121,7 +121,7 @@ open class Switch: UIControl { ...@@ -121,7 +121,7 @@ open class Switch: UIControl {
/// Track off color. /// Track off color.
@IBInspectable @IBInspectable
public var trackOffColor = Color.clear { open var trackOffColor = Color.clear {
didSet { didSet {
styleForState(state: switchState) styleForState(state: switchState)
} }
...@@ -129,7 +129,7 @@ open class Switch: UIControl { ...@@ -129,7 +129,7 @@ open class Switch: UIControl {
/// Button on disabled color. /// Button on disabled color.
@IBInspectable @IBInspectable
public var buttonOnDisabledColor = Color.clear { open var buttonOnDisabledColor = Color.clear {
didSet { didSet {
styleForState(state: switchState) styleForState(state: switchState)
} }
...@@ -137,7 +137,7 @@ open class Switch: UIControl { ...@@ -137,7 +137,7 @@ open class Switch: UIControl {
/// Track on disabled color. /// Track on disabled color.
@IBInspectable @IBInspectable
public var trackOnDisabledColor = Color.clear { open var trackOnDisabledColor = Color.clear {
didSet { didSet {
styleForState(state: switchState) styleForState(state: switchState)
} }
...@@ -145,7 +145,7 @@ open class Switch: UIControl { ...@@ -145,7 +145,7 @@ open class Switch: UIControl {
/// Button off disabled color. /// Button off disabled color.
@IBInspectable @IBInspectable
public var buttonOffDisabledColor = Color.clear { open var buttonOffDisabledColor = Color.clear {
didSet { didSet {
styleForState(state: switchState) styleForState(state: switchState)
} }
...@@ -153,21 +153,21 @@ open class Switch: UIControl { ...@@ -153,21 +153,21 @@ open class Switch: UIControl {
/// Track off disabled color. /// Track off disabled color.
@IBInspectable @IBInspectable
public var trackOffDisabledColor = Color.clear { open var trackOffDisabledColor = Color.clear {
didSet { didSet {
styleForState(state: switchState) styleForState(state: switchState)
} }
} }
/// Track view reference. /// Track view reference.
public private(set) var track: UIView { open private(set) var track: UIView {
didSet { didSet {
prepareTrack() prepareTrack()
} }
} }
/// Button view reference. /// Button view reference.
public private(set) var button: FabButton { open private(set) var button: FabButton {
didSet { didSet {
prepareButton() prepareButton()
} }
......
...@@ -74,7 +74,7 @@ open class TableViewCell: UITableViewCell { ...@@ -74,7 +74,7 @@ open class TableViewCell: UITableViewCell {
} }
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's background
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
didSet { didSet {
......
...@@ -125,7 +125,7 @@ open class TextField: UITextField { ...@@ -125,7 +125,7 @@ open class TextField: UITextField {
@IBInspectable @IBInspectable
open private(set) var placeholderLabel: UILabel! open private(set) var placeholderLabel: UILabel!
/// Placeholder normal textColor. /// Placeholder normal text
@IBInspectable @IBInspectable
open var placeholderNormalColor = Color.darkText.others { open var placeholderNormalColor = Color.darkText.others {
didSet { didSet {
...@@ -141,7 +141,7 @@ open class TextField: UITextField { ...@@ -141,7 +141,7 @@ open class TextField: UITextField {
} }
} }
/// Placeholder active textColor. /// Placeholder active text
@IBInspectable @IBInspectable
open var placeholderActiveColor = Color.blue.base { open var placeholderActiveColor = Color.blue.base {
didSet { didSet {
...@@ -178,7 +178,7 @@ open class TextField: UITextField { ...@@ -178,7 +178,7 @@ open class TextField: UITextField {
} }
} }
/// Detail textColor. /// Detail text
@IBInspectable @IBInspectable
open var detailColor = Color.darkText.others { open var detailColor = Color.darkText.others {
didSet { didSet {
......
...@@ -35,7 +35,7 @@ public protocol TextViewDelegate : UITextViewDelegate {} ...@@ -35,7 +35,7 @@ public protocol TextViewDelegate : UITextViewDelegate {}
@objc(TextView) @objc(TextView)
public class TextView: UITextView { public class TextView: UITextView {
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's background
@IBInspectable public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.cgColor layer.backgroundColor = backgroundColor?.cgColor
...@@ -223,7 +223,7 @@ public class TextView: UITextView { ...@@ -223,7 +223,7 @@ public class TextView: UITextView {
public func prepare() { public func prepare() {
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
textContainerInset = .zero textContainerInset = .zero
backgroundColor = Color.white backgroundColor = .white
clipsToBounds = false clipsToBounds = false
removeNotificationHandlers() removeNotificationHandlers()
prepareNotificationHandlers() prepareNotificationHandlers()
...@@ -236,7 +236,7 @@ public class TextView: UITextView { ...@@ -236,7 +236,7 @@ public class TextView: UITextView {
v.font = font v.font = font
v.textAlignment = textAlignment v.textAlignment = textAlignment
v.numberOfLines = 0 v.numberOfLines = 0
v.backgroundColor = Color.clear v.backgroundColor = .clear
addSubview(v) addSubview(v)
reloadView() reloadView()
handleTextViewTextDidChange() handleTextViewTextDidChange()
......
...@@ -116,7 +116,7 @@ open class View: UIView { ...@@ -116,7 +116,7 @@ open class View: UIView {
} }
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's background
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
didSet { didSet {
......
...@@ -58,28 +58,28 @@ public protocol ColorPalette { ...@@ -58,28 +58,28 @@ public protocol ColorPalette {
open class Color { open class Color {
// clear // clear
open static let clear = NSColor.clear open static let clear = NSclear
// white // white
open static let white = NSColor.white open static let white = NSwhite
// black // black
open static let black = NSColor.black open static let black = NSblack
// dark text // dark text
open class darkText { open class darkText {
open static let primary = Color.black.withAlphaComponent(0.87) open static let primary = black.withAlphaComponent(0.87)
open static let secondary = Color.black.withAlphaComponent(0.54) open static let secondary = black.withAlphaComponent(0.54)
open static let others = Color.black.withAlphaComponent(0.38) open static let others = black.withAlphaComponent(0.38)
open static let dividers = Color.black.withAlphaComponent(0.12) open static let dividers = black.withAlphaComponent(0.12)
} }
// light text // light text
open class lightText { open class lightText {
open static let primary = Color.white open static let primary = white
open static let secondary = Color.white.withAlphaComponent(0.7) open static let secondary = white.withAlphaComponent(0.7)
open static let others = Color.white.withAlphaComponent(0.5) open static let others = white.withAlphaComponent(0.5)
open static let dividers = Color.white.withAlphaComponent(0.12) open static let dividers = white.withAlphaComponent(0.12)
} }
// red // red
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment