Commit 42e6257c by Daniel Dahan

development: updated remaining example projects for HeightPreset

parent da92a778
...@@ -32,7 +32,6 @@ import UIKit ...@@ -32,7 +32,6 @@ import UIKit
import Material import Material
class ViewController: UIViewController { class ViewController: UIViewController {
/// A reference to the Layer.
private var layer: Layer! private var layer: Layer!
override func viewDidLoad() { override func viewDidLoad() {
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
9640ED151DAE115D0085CDA1 /* AppStatusBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9640ED141DAE115D0085CDA1 /* AppStatusBarController.swift */; };
96CC49CD1D8DD984002CAB55 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC49CC1D8DD984002CAB55 /* AppDelegate.swift */; }; 96CC49CD1D8DD984002CAB55 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC49CC1D8DD984002CAB55 /* AppDelegate.swift */; };
96CC49CF1D8DD984002CAB55 /* RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC49CE1D8DD984002CAB55 /* RootViewController.swift */; }; 96CC49CF1D8DD984002CAB55 /* RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC49CE1D8DD984002CAB55 /* RootViewController.swift */; };
96CC49D41D8DD984002CAB55 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96CC49D31D8DD984002CAB55 /* Assets.xcassets */; }; 96CC49D41D8DD984002CAB55 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96CC49D31D8DD984002CAB55 /* Assets.xcassets */; };
...@@ -30,7 +29,6 @@ ...@@ -30,7 +29,6 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
9640ED141DAE115D0085CDA1 /* AppStatusBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppStatusBarController.swift; sourceTree = "<group>"; };
96CC49C91D8DD984002CAB55 /* NavigationController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NavigationController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 96CC49C91D8DD984002CAB55 /* NavigationController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NavigationController.app; sourceTree = BUILT_PRODUCTS_DIR; };
96CC49CC1D8DD984002CAB55 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 96CC49CC1D8DD984002CAB55 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96CC49CE1D8DD984002CAB55 /* RootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewController.swift; sourceTree = "<group>"; }; 96CC49CE1D8DD984002CAB55 /* RootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewController.swift; sourceTree = "<group>"; };
...@@ -72,7 +70,6 @@ ...@@ -72,7 +70,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96CC49CC1D8DD984002CAB55 /* AppDelegate.swift */, 96CC49CC1D8DD984002CAB55 /* AppDelegate.swift */,
9640ED141DAE115D0085CDA1 /* AppStatusBarController.swift */,
96CC49DE1D8DD9E8002CAB55 /* AppNavigationController.swift */, 96CC49DE1D8DD9E8002CAB55 /* AppNavigationController.swift */,
96CC49CE1D8DD984002CAB55 /* RootViewController.swift */, 96CC49CE1D8DD984002CAB55 /* RootViewController.swift */,
96CC49E41D8DDF61002CAB55 /* NextViewController.swift */, 96CC49E41D8DDF61002CAB55 /* NextViewController.swift */,
...@@ -155,7 +152,6 @@ ...@@ -155,7 +152,6 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9640ED151DAE115D0085CDA1 /* AppStatusBarController.swift in Sources */,
96CC49DF1D8DD9E8002CAB55 /* AppNavigationController.swift in Sources */, 96CC49DF1D8DD9E8002CAB55 /* AppNavigationController.swift in Sources */,
96CC49E51D8DDF61002CAB55 /* NextViewController.swift in Sources */, 96CC49E51D8DDF61002CAB55 /* NextViewController.swift in Sources */,
96CC49CF1D8DD984002CAB55 /* RootViewController.swift in Sources */, 96CC49CF1D8DD984002CAB55 /* RootViewController.swift in Sources */,
......
...@@ -38,7 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -38,7 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationDidFinishLaunching(_ application: UIApplication) { func applicationDidFinishLaunching(_ application: UIApplication) {
window = UIWindow(frame: Device.bounds) window = UIWindow(frame: Device.bounds)
window!.rootViewController = AppStatusBarController(rootViewController: AppNavigationController(rootViewController: RootViewController())) window!.rootViewController = AppNavigationController(rootViewController: RootViewController())
window!.makeKeyAndVisible() window!.makeKeyAndVisible()
} }
} }
......
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
import Material
class AppStatusBarController: StatusBarController {
open override func prepare() {
super.prepare()
statusBarStyle = .default
statusBar.backgroundColor = .white
}
}
...@@ -43,6 +43,7 @@ class AppToolbarController: ToolbarController { ...@@ -43,6 +43,7 @@ class AppToolbarController: ToolbarController {
prepareMenuButton() prepareMenuButton()
prepareSwitch() prepareSwitch()
prepareMoreButton() prepareMoreButton()
prepareStatusBar()
prepareToolbar() prepareToolbar()
} }
...@@ -70,6 +71,13 @@ class AppToolbarController: ToolbarController { ...@@ -70,6 +71,13 @@ class AppToolbarController: ToolbarController {
moreButton.addTarget(self, action: #selector(handleMoreButton), for: .touchUpInside) moreButton.addTarget(self, action: #selector(handleMoreButton), for: .touchUpInside)
} }
private func prepareStatusBar() {
statusBarStyle = .lightContent
// Access the statusBar.
// statusBar.backgroundColor = Color.green.base
}
private func prepareToolbar() { private func prepareToolbar() {
toolbar.leftViews = [menuButton] toolbar.leftViews = [menuButton]
toolbar.rightViews = [switchControl, moreButton] toolbar.rightViews = [switchControl, moreButton]
......
...@@ -56,6 +56,7 @@ class LeftViewController: UIViewController { ...@@ -56,6 +56,7 @@ class LeftViewController: UIViewController {
private func prepareTransitionButton() { private func prepareTransitionButton() {
transitionButton = FlatButton(title: "Transition VC", titleColor: .white) transitionButton = FlatButton(title: "Transition VC", titleColor: .white)
transitionButton.pulseColor = .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()
......
...@@ -42,7 +42,7 @@ class RightViewController: UIViewController { ...@@ -42,7 +42,7 @@ class RightViewController: UIViewController {
} }
@objc @objc
internal func handleTransitionButton() { internal func handleRootButton() {
// Transition the entire NavigationDrawer rootViewController. // Transition the entire NavigationDrawer rootViewController.
// navigationDrawerController?.transition(to: RootViewController(), completion: closeNavigationDrawer) // navigationDrawerController?.transition(to: RootViewController(), completion: closeNavigationDrawer)
...@@ -56,7 +56,8 @@ class RightViewController: UIViewController { ...@@ -56,7 +56,8 @@ class RightViewController: UIViewController {
private func prepareRootButton() { private func prepareRootButton() {
rootButton = FlatButton(title: "Root VC", titleColor: .white) rootButton = FlatButton(title: "Root VC", titleColor: .white)
rootButton.addTarget(self, action: #selector(handleTransitionButton), for: .touchUpInside) rootButton.pulseColor = .white
rootButton.addTarget(self, action: #selector(handleRootButton), for: .touchUpInside)
view.layout(rootButton).horizontally().center() view.layout(rootButton).horizontally().center()
} }
......
...@@ -34,7 +34,8 @@ import Material ...@@ -34,7 +34,8 @@ import Material
class RootViewController: UIViewController { class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = .white view.backgroundColor = Color.grey.lighten5
prepareToolbar() prepareToolbar()
} }
......
...@@ -55,7 +55,7 @@ class AppSearchBarController: SearchBarController { ...@@ -55,7 +55,7 @@ class AppSearchBarController: SearchBarController {
statusBarStyle = .lightContent statusBarStyle = .lightContent
// Access the statusBar. // Access the statusBar.
// statusBar.backgroundColor = .green // statusBar.backgroundColor = Color.green.base
} }
private func prepareSearchBar() { private func prepareSearchBar() {
......
...@@ -34,7 +34,13 @@ import Material ...@@ -34,7 +34,13 @@ import Material
class AppStatusBarController: StatusBarController { class AppStatusBarController: StatusBarController {
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
statusBarStyle = .default
prepareStatusBar()
}
private func prepareStatusBar() {
statusBarStyle = .lightContent
statusBar.backgroundColor = Color.blue.base
} }
} }
...@@ -32,10 +32,7 @@ import UIKit ...@@ -32,10 +32,7 @@ import UIKit
import Material import Material
class ViewController: UIViewController { class ViewController: UIViewController {
/// Buttons for the TabBar.
private lazy var buttons = [Button]() private lazy var buttons = [Button]()
/// A reference to the TabBar.
private var tabBar: TabBar! private var tabBar: TabBar!
override func viewDidLoad() { override func viewDidLoad() {
...@@ -62,6 +59,7 @@ class ViewController: UIViewController { ...@@ -62,6 +59,7 @@ class ViewController: UIViewController {
private func prepareTabBar() { private func prepareTabBar() {
tabBar = TabBar() tabBar = TabBar()
tabBar.delegate = self
tabBar.dividerColor = Color.grey.lighten3 tabBar.dividerColor = Color.grey.lighten3
tabBar.dividerAlignment = .top tabBar.dividerAlignment = .top
...@@ -76,3 +74,13 @@ class ViewController: UIViewController { ...@@ -76,3 +74,13 @@ class ViewController: UIViewController {
} }
} }
extension ViewController: TabBarDelegate {
func tabBar(tabBar: TabBar, willSelect button: UIButton) {
print("will select")
}
func tabBar(tabBar: TabBar, didSelect button: UIButton) {
print("did select")
}
}
...@@ -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 = amber.darken4 emailField.placeholderNormalColor = Color.amber.darken4
emailField.placeholderActiveColor = pink.base emailField.placeholderActiveColor = Color.pink.base
emailField.dividerNormalColor = cyan.base emailField.dividerNormalColor = Color.cyan.base
view.addSubview(emailField) view.addSubview(emailField)
} }
......
...@@ -32,17 +32,16 @@ import UIKit ...@@ -32,17 +32,16 @@ import UIKit
import Material import Material
class ViewController: UIViewController { class ViewController: UIViewController {
/// A reference to the View.
private var logo: View! private var logo: View!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = .white view.backgroundColor = .white
prepareLogo() prepareView()
} }
private func prepareLogo() { private func prepareView() {
let d: CGFloat = 100 let d: CGFloat = 100
logo = View() logo = View()
......
...@@ -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 = .grey.lighten3 tabBar.dividerColor = Color.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 = .blue.base view.backgroundColor = Color.blue.base
} }
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.title = nil tabBarItem.title = nil
tabBarItem.image = Icon.cm.audioLibrary?.tint(with: .blueGrey.base) tabBarItem.image = Icon.cm.audioLibrary?.tint(with: Color.blueGrey.base)
tabBarItem.selectedImage = Icon.cm.audioLibrary?.tint(with: .blue.base) tabBarItem.selectedImage = Icon.cm.audioLibrary?.tint(with: Color.blue.base)
} }
} }
...@@ -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 = .red.base view.backgroundColor = Color.red.base
} }
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.title = nil tabBarItem.title = nil
tabBarItem.image = Icon.cm.photoCamera?.tint(with: .blueGrey.base) tabBarItem.image = Icon.cm.photoCamera?.tint(with: Color.blueGrey.base)
tabBarItem.selectedImage = Icon.cm.photoCamera?.tint(with: .blue.base) tabBarItem.selectedImage = Icon.cm.photoCamera?.tint(with: Color.blue.base)
} }
} }
...@@ -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 = .yellow.base view.backgroundColor = Color.yellow.base
} }
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.title = nil tabBarItem.title = nil
tabBarItem.image = Icon.cm.bell?.tint(with: .blueGrey.base) tabBarItem.image = Icon.cm.bell?.tint(with: Color.blueGrey.base)
tabBarItem.selectedImage = Icon.cm.bell?.tint(with: .blue.base) tabBarItem.selectedImage = Icon.cm.bell?.tint(with: Color.blue.base)
} }
} }
...@@ -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 = .blueGrey.base view.backgroundColor = Color.blueGrey.base
} }
private func prepareTabBarItem() { private func prepareTabBarItem() {
tabBarItem.title = nil tabBarItem.title = nil
tabBarItem.image = Icon.cm.search?.tint(with: .blueGrey.base) tabBarItem.image = Icon.cm.search?.tint(with: Color.blueGrey.base)
tabBarItem.selectedImage = Icon.cm.search?.tint(with: .blue.base) tabBarItem.selectedImage = Icon.cm.search?.tint(with: Color.blue.base)
} }
} }
...@@ -34,7 +34,12 @@ import Material ...@@ -34,7 +34,12 @@ import Material
class AppNavigationController: NavigationController { class AppNavigationController: NavigationController {
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
statusBarStyle = .default guard let v = navigationBar as? NavigationBar else {
return
}
v.depthPreset = .none
v.dividerColor = Color.grey.lighten3
} }
} }
...@@ -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 = Color.grey.lighten5
prepareNavigationItem() prepareNavigationItem()
} }
...@@ -43,7 +43,8 @@ class NextViewController: UIViewController { ...@@ -43,7 +43,8 @@ class NextViewController: UIViewController {
navigationItem.title = "Title" navigationItem.title = "Title"
navigationItem.detail = "Detail Description" navigationItem.detail = "Detail Description"
navigationItem.backButton.tintColor = Color.blue.base // Access the back button.
// 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.lighten1 view.backgroundColor = Color.grey.lighten5
prepareMenuButton() prepareMenuButton()
prepareStarButton() prepareStarButton()
...@@ -77,6 +77,7 @@ class RootViewController: UIViewController { ...@@ -77,6 +77,7 @@ class RootViewController: UIViewController {
private func prepareNextButton() { private func prepareNextButton() {
nextButton = FlatButton() nextButton = FlatButton()
nextButton.pulseAnimation = .none
nextButton.addTarget(self, action: #selector(handleNextButton), for: .touchUpInside) nextButton.addTarget(self, action: #selector(handleNextButton), for: .touchUpInside)
view.layout(nextButton).edges() view.layout(nextButton).edges()
} }
......
...@@ -32,9 +32,35 @@ import UIKit ...@@ -32,9 +32,35 @@ import UIKit
import Material import Material
class AppSearchBarController: SearchBarController { class AppSearchBarController: SearchBarController {
private var menuButton: IconButton!
private var moreButton: IconButton!
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
statusBarStyle = .default prepareMenuButton()
prepareMoreButton()
prepareStatusBar()
prepareSearchBar()
}
private func prepareMenuButton() {
menuButton = IconButton(image: Icon.cm.menu)
}
private func prepareMoreButton() {
moreButton = IconButton(image: Icon.cm.moreVertical)
}
private func prepareStatusBar() {
statusBarStyle = .lightContent
// Access the statusBar.
// statusBar.backgroundColor = Color.green.base
}
private func prepareSearchBar() {
searchBar.leftViews = [menuButton]
searchBar.rightViews = [moreButton]
} }
} }
...@@ -32,37 +32,18 @@ import UIKit ...@@ -32,37 +32,18 @@ import UIKit
import Material import Material
class RootViewController: UIViewController { class RootViewController: UIViewController {
private var menuButton: IconButton!
private var moreButton: IconButton!
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten1 view.backgroundColor = Color.grey.lighten5
}
open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
prepareMenuButton()
prepareMoreButton()
prepareSearchBar() prepareSearchBar()
} }
private func prepareMenuButton() {
menuButton = IconButton(image: Icon.cm.menu)
}
private func prepareMoreButton() {
moreButton = IconButton(image: Icon.cm.moreVertical)
}
private func prepareSearchBar() { private func prepareSearchBar() {
guard let sc = searchBarController else { // Access the searchBar.
return // guard let searchBar = searchBarController?.searchBar else {
} // return
// }
sc.searchBar.leftViews = [menuButton]
sc.searchBar.rightViews = [moreButton]
} }
} }
...@@ -39,19 +39,19 @@ class AppSnackbarController: SnackbarController { ...@@ -39,19 +39,19 @@ class AppSnackbarController: SnackbarController {
} }
extension AppSnackbarController: SnackbarControllerDelegate { extension AppSnackbarController: SnackbarControllerDelegate {
func snackbarControllerWillShow(snackbarController: SnackbarController) { func snackbarController(snackbarController: SnackbarController, willShow snackbar: Snackbar) {
print("snackbarControllerWillShow") print("snackbarController will show")
} }
func snackbarControllerWillHide(snackbarController: SnackbarController) { func snackbarController(snackbarController: SnackbarController, willHide snackbar: Snackbar) {
print("snackbarControllerWillHide") print("snackbarController will hide")
} }
func snackbarControllerDidShow(snackbarController: SnackbarController) { func snackbarController(snackbarController: SnackbarController, didShow snackbar: Snackbar) {
print("snackbarControllerDidShow") print("snackbarController did show")
} }
func snackbarControllerDidHide(snackbarController: SnackbarController) { func snackbarController(snackbarController: SnackbarController, didHide snackbar: Snackbar) {
print("snackbarControllerDidHide") print("snackbarController did hide")
} }
} }
...@@ -37,12 +37,13 @@ class RootViewController: UIViewController { ...@@ -37,12 +37,13 @@ class RootViewController: UIViewController {
open override func viewDidLoad() { open override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = Color.grey.lighten5
prepareUndoButton()
} }
open override func viewDidAppear(_ animated: Bool) { open override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated) super.viewDidAppear(animated)
prepareUndoButton()
prepareSnackbar() prepareSnackbar()
animateSnackbar() animateSnackbar()
scheduleAnimation() scheduleAnimation()
...@@ -55,12 +56,12 @@ class RootViewController: UIViewController { ...@@ -55,12 +56,12 @@ class RootViewController: UIViewController {
} }
private func prepareSnackbar() { private func prepareSnackbar() {
guard let sc = snackbarController else { guard let snackbar = snackbarController?.snackbar else {
return return
} }
sc.snackbar.text = "Reminder saved." snackbar.text = "Reminder saved."
sc.snackbar.rightViews = [undoButton] snackbar.rightViews = [undoButton]
} }
private func scheduleAnimation() { private func scheduleAnimation() {
......
...@@ -34,7 +34,13 @@ import Material ...@@ -34,7 +34,13 @@ import Material
class AppStatusBarController: StatusBarController { class AppStatusBarController: StatusBarController {
open override func prepare() { open override func prepare() {
super.prepare() super.prepare()
statusBarStyle = .default
prepareStatusBar()
}
private func prepareStatusBar() {
statusBarStyle = .lightContent
statusBar.backgroundColor = Color.blue.base
} }
} }
...@@ -37,7 +37,7 @@ open class NavigationBar: UINavigationBar { ...@@ -37,7 +37,7 @@ open class NavigationBar: UINavigationBar {
} }
open override var intrinsicContentSize: CGSize { open override var intrinsicContentSize: CGSize {
return CGSize(width: width, height: height) return CGSize(width: Device.width, height: height)
} }
/// A preset wrapper around contentEdgeInsets. /// A preset wrapper around contentEdgeInsets.
......
...@@ -78,7 +78,7 @@ open class StatusBarController: RootController { ...@@ -78,7 +78,7 @@ open class StatusBarController: RootController {
/// Prepares the statusBar. /// Prepares the statusBar.
private func prepareStatusBar() { private func prepareStatusBar() {
statusBar.zPosition = 3000 statusBar.zPosition = 3000
statusBar.backgroundColor = Color.grey.lighten3 statusBar.backgroundColor = .white
view.layout(statusBar).top().horizontally().height(20) view.layout(statusBar).top().horizontally().height(20)
} }
} }
...@@ -45,7 +45,7 @@ public protocol TabBarDelegate { ...@@ -45,7 +45,7 @@ public protocol TabBarDelegate {
- Parameter button: A UIButton. - Parameter button: A UIButton.
*/ */
@objc @objc
optional func tabBarWillSelectButton(tabBar: TabBar, button: UIButton) optional func tabBar(tabBar: TabBar, willSelect button: UIButton)
/** /**
A delegation method that is executed when the button did complete the A delegation method that is executed when the button did complete the
...@@ -54,7 +54,7 @@ public protocol TabBarDelegate { ...@@ -54,7 +54,7 @@ public protocol TabBarDelegate {
- Parameter button: A UIButton. - Parameter button: A UIButton.
*/ */
@objc @objc
optional func tabBarDidSelectButton(tabBar: TabBar, button: UIButton) optional func tabBar(tabBar: TabBar, didSelect button: UIButton)
} }
open class TabBar: Bar { open class TabBar: Bar {
...@@ -174,7 +174,7 @@ open class TabBar: Bar { ...@@ -174,7 +174,7 @@ open class TabBar: Bar {
- Paramater completion: An optional completion block. - Paramater completion: An optional completion block.
*/ */
open func animate(to button: UIButton, completion: ((UIButton) -> Void)? = nil) { open func animate(to button: UIButton, completion: ((UIButton) -> Void)? = nil) {
delegate?.tabBarWillSelectButton?(tabBar: self, button: button) delegate?.tabBar?(tabBar: self, willSelect: button)
selected = button selected = button
isAnimating = true isAnimating = true
UIView.animate(withDuration: 0.25, animations: { [weak self, button = button] in UIView.animate(withDuration: 0.25, animations: { [weak self, button = button] in
...@@ -188,7 +188,7 @@ open class TabBar: Bar { ...@@ -188,7 +188,7 @@ open class TabBar: Bar {
return return
} }
s.isAnimating = false s.isAnimating = false
s.delegate?.tabBarDidSelectButton?(tabBar: s, button: button) s.delegate?.tabBar?(tabBar: s, didSelect: button)
completion?(button) completion?(button)
} }
} }
......
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