Commit 91cebc7a by Daniel Dahan

updated NavigationViewController to be NavigationBarViewController

parent e4bf38c6
...@@ -96,9 +96,9 @@ ...@@ -96,9 +96,9 @@
</Group> </Group>
<Group <Group
location = "container:" location = "container:"
name = "NavigationViewController"> name = "NavigationBarViewController">
<FileRef <FileRef
location = "group:Programmatic/NavigationViewController/NavigationViewController.xcodeproj"> location = "group:Programmatic/NavigationBarViewController/NavigationBarViewController.xcodeproj">
</FileRef> </FileRef>
</Group> </Group>
<Group <Group
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef <FileRef
location = "self:NavigationViewController.xcodeproj"> location = "self:NavigationBarViewController.xcodeproj">
</FileRef> </FileRef>
</Workspace> </Workspace>
...@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch. // Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds) window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = AppNavigationViewController(mainViewController: MainViewController()) window!.rootViewController = AppNavigationBarViewController(mainViewController: MainViewController())
window!.makeKeyAndVisible() window!.makeKeyAndVisible()
return true return true
} }
......
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
*/ */
/* /*
The following is an example of using a NavigationViewController to control the The following is an example of using a NavigationBarViewController to control the
flow of your application. flow of your application.
*/ */
import UIKit import UIKit
import Material import Material
class AppNavigationViewController: NavigationViewController { class AppNavigationBarViewController: NavigationBarViewController {
/// Menu backdrop layer. /// Menu backdrop layer.
private lazy var menuBackdropLayer: MaterialLayer = MaterialLayer() private lazy var menuBackdropLayer: MaterialLayer = MaterialLayer()
...@@ -59,18 +59,18 @@ class AppNavigationViewController: NavigationViewController { ...@@ -59,18 +59,18 @@ class AppNavigationViewController: NavigationViewController {
/** /**
Handles the menu button click, which opens the Handles the menu button click, which opens the
SideNavigationViewController. SideNavigationBarViewController.
*/ */
func handleMenuButton() { func handleMenuButton() {
sideNavigationViewController?.openLeftView() sideNavigationBarViewController?.openLeftView()
} }
/** /**
Handles the more button click, which opens the Handles the more button click, which opens the
SideNavigationViewController. SideNavigationBarViewController.
*/ */
func handleMoreButton() { func handleMoreButton() {
sideNavigationViewController?.openRightView() sideNavigationBarViewController?.openRightView()
} }
/// Handle the menuView touch event. /// Handle the menuView touch event.
...@@ -210,7 +210,7 @@ class AppNavigationViewController: NavigationViewController { ...@@ -210,7 +210,7 @@ class AppNavigationViewController: NavigationViewController {
/// Displays the menuBackdropLayer. /// Displays the menuBackdropLayer.
private func showMenuBackdropLayer() { private func showMenuBackdropLayer() {
// Disable the side nav, so users can't swipe while viewing the menu. // Disable the side nav, so users can't swipe while viewing the menu.
sideNavigationViewController?.enabled = false sideNavigationBarViewController?.enabled = false
// Position the menuBackdropLayer for the animation when opening. // Position the menuBackdropLayer for the animation when opening.
MaterialAnimation.animationDisabled { [unowned self] in MaterialAnimation.animationDisabled { [unowned self] in
...@@ -225,7 +225,7 @@ class AppNavigationViewController: NavigationViewController { ...@@ -225,7 +225,7 @@ class AppNavigationViewController: NavigationViewController {
/// Hides the menuBackdropLayer. /// Hides the menuBackdropLayer.
private func hideMenuBackdropLayer() { private func hideMenuBackdropLayer() {
// Enable the side nav. // Enable the side nav.
sideNavigationViewController?.enabled = true sideNavigationBarViewController?.enabled = true
// Position the menuBackdropLayer for the animation when closing. // Position the menuBackdropLayer for the animation when closing.
menuBackdropLayer.animate(MaterialAnimation.animationGroup([ menuBackdropLayer.animate(MaterialAnimation.animationGroup([
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_menu_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_menu_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_menu_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_more_horiz_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_more_horiz_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_more_horiz_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -53,10 +53,10 @@ class MainViewController: UIViewController { ...@@ -53,10 +53,10 @@ class MainViewController: UIViewController {
/** /**
Handles the search button click, which opens the Handles the search button click, which opens the
SideNavigationViewController. SideNavigationBarViewController.
*/ */
func handleSearchButton() { func handleSearchButton() {
sideNavigationViewController?.openRightView() sideNavigationBarViewController?.openRightView()
} }
/// Prepares view. /// Prepares view.
...@@ -130,7 +130,7 @@ extension MainViewController: UITableViewDataSource { ...@@ -130,7 +130,7 @@ extension MainViewController: UITableViewDataSource {
header.addSubview(label) header.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false label.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(header, child: label, left: navigationViewController!.navigationBarView.contentInset.left + navigationViewController!.navigationBarView.spacing) MaterialLayout.alignToParent(header, child: label, left: navigationBarViewController!.navigationBarView.contentInset.left + navigationBarViewController!.navigationBarView.spacing)
return header return header
} }
......
...@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch. // Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds) window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = SideNavigationViewController(mainViewController: AppNavigationViewController(mainViewController: FeedViewController()), leftViewController: LeftViewController(), rightViewController: RightViewController()) window!.rootViewController = SideNavigationBarViewController(mainViewController: AppNavigationBarViewController(mainViewController: FeedViewController()), leftViewController: LeftViewController(), rightViewController: RightViewController())
window!.makeKeyAndVisible() window!.makeKeyAndVisible()
return true return true
} }
......
...@@ -30,15 +30,15 @@ ...@@ -30,15 +30,15 @@
/* /*
The following is an example of setting a UITableView as the MainViewController The following is an example of setting a UITableView as the MainViewController
within a SideNavigationViewController. There is a NavigationBarView that is within a SideNavigationBarViewController. There is a NavigationBarView that is
used for navigation, with a menu button that opens the used for navigation, with a menu button that opens the
SideNavigationViewController. SideNavigationBarViewController.
*/ */
import UIKit import UIKit
import Material import Material
class AppNavigationViewController: NavigationViewController { class AppNavigationBarViewController: NavigationBarViewController {
/// Menu backdrop layer. /// Menu backdrop layer.
private lazy var menuBackdropLayer: MaterialLayer = MaterialLayer() private lazy var menuBackdropLayer: MaterialLayer = MaterialLayer()
...@@ -63,29 +63,29 @@ class AppNavigationViewController: NavigationViewController { ...@@ -63,29 +63,29 @@ class AppNavigationViewController: NavigationViewController {
super.viewWillAppear(animated) super.viewWillAppear(animated)
/* /*
Set the width of the SideNavigationViewController. Be mindful Set the width of the SideNavigationBarViewController. Be mindful
of when setting this value. It is set in the viewWillAppear method, of when setting this value. It is set in the viewWillAppear method,
because any earlier may cause a race condition when instantiating because any earlier may cause a race condition when instantiating
the MainViewController and SideViewController. the MainViewController and SideViewController.
*/ */
// sideNavigationViewController?.setLeftViewWidth(view.bounds.width - menuViewDiameter - 2 * menuViewInset, hidden: true, animated: false) // sideNavigationBarViewController?.setLeftViewWidth(view.bounds.width - menuViewDiameter - 2 * menuViewInset, hidden: true, animated: false)
sideNavigationViewController?.delegate = self sideNavigationBarViewController?.delegate = self
} }
/** /**
Handles the menu button click, which opens the Handles the menu button click, which opens the
SideNavigationViewController. SideNavigationBarViewController.
*/ */
func handleMenuButton() { func handleMenuButton() {
sideNavigationViewController?.openLeftView() sideNavigationBarViewController?.openLeftView()
} }
/** /**
Handles the more button click, which opens the Handles the more button click, which opens the
SideNavigationViewController. SideNavigationBarViewController.
*/ */
func handleMoreButton() { func handleMoreButton() {
sideNavigationViewController?.openRightView() sideNavigationBarViewController?.openRightView()
} }
/// Handle the menuView touch event. /// Handle the menuView touch event.
...@@ -225,7 +225,7 @@ class AppNavigationViewController: NavigationViewController { ...@@ -225,7 +225,7 @@ class AppNavigationViewController: NavigationViewController {
/// Displays the menuBackdropLayer. /// Displays the menuBackdropLayer.
private func showMenuBackdropLayer() { private func showMenuBackdropLayer() {
// Disable the side nav, so users can't swipe while viewing the menu. // Disable the side nav, so users can't swipe while viewing the menu.
sideNavigationViewController?.enabled = false sideNavigationBarViewController?.enabled = false
// Position the menuBackdropLayer for the animation when opening. // Position the menuBackdropLayer for the animation when opening.
MaterialAnimation.animationDisabled { [unowned self] in MaterialAnimation.animationDisabled { [unowned self] in
...@@ -240,7 +240,7 @@ class AppNavigationViewController: NavigationViewController { ...@@ -240,7 +240,7 @@ class AppNavigationViewController: NavigationViewController {
/// Hides the menuBackdropLayer. /// Hides the menuBackdropLayer.
private func hideMenuBackdropLayer() { private func hideMenuBackdropLayer() {
// Enable the side nav. // Enable the side nav.
sideNavigationViewController?.enabled = true sideNavigationBarViewController?.enabled = true
// Position the menuBackdropLayer for the animation when closing. // Position the menuBackdropLayer for the animation when closing.
menuBackdropLayer.animate(MaterialAnimation.animationGroup([ menuBackdropLayer.animate(MaterialAnimation.animationGroup([
...@@ -254,69 +254,69 @@ class AppNavigationViewController: NavigationViewController { ...@@ -254,69 +254,69 @@ class AppNavigationViewController: NavigationViewController {
} }
} }
/// SideNavigationViewControllerDelegate methods. /// SideNavigationBarViewControllerDelegate methods.
extension AppNavigationViewController: SideNavigationViewControllerDelegate { extension AppNavigationBarViewController: SideNavigationBarViewControllerDelegate {
/** /**
An optional delegation method that is fired before the An optional delegation method that is fired before the
SideNavigationViewController opens. SideNavigationBarViewController opens.
*/ */
func sideNavigationViewWillOpen(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition) { func sideNavigationViewWillOpen(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition) {
print("Will open", .Left == position ? "Left" : "Right", "view.") print("Will open", .Left == position ? "Left" : "Right", "view.")
} }
/** /**
An optional delegation method that is fired after the An optional delegation method that is fired after the
SideNavigationViewController opened. SideNavigationBarViewController opened.
*/ */
func sideNavigationViewDidOpen(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition) { func sideNavigationViewDidOpen(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition) {
print("Did open", .Left == position ? "Left" : "Right", "view.") print("Did open", .Left == position ? "Left" : "Right", "view.")
} }
/** /**
An optional delegation method that is fired before the An optional delegation method that is fired before the
SideNavigationViewController closes. SideNavigationBarViewController closes.
*/ */
func sideNavigationViewWillClose(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition) { func sideNavigationViewWillClose(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition) {
print("Will close", .Left == position ? "Left" : "Right", "view.") print("Will close", .Left == position ? "Left" : "Right", "view.")
} }
/** /**
An optional delegation method that is fired after the An optional delegation method that is fired after the
SideNavigationViewController closed. SideNavigationBarViewController closed.
*/ */
func sideNavigationViewDidClose(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition) { func sideNavigationViewDidClose(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition) {
print("Did close", .Left == position ? "Left" : "Right", "view.") print("Did close", .Left == position ? "Left" : "Right", "view.")
} }
/** /**
An optional delegation method that is fired when the An optional delegation method that is fired when the
SideNavigationViewController pan gesture begins. SideNavigationBarViewController pan gesture begins.
*/ */
func sideNavigationViewPanDidBegin(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition) { func sideNavigationViewPanDidBegin(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition) {
print("Pan did begin for", .Left == position ? "Left" : "Right", "view.") print("Pan did begin for", .Left == position ? "Left" : "Right", "view.")
} }
/** /**
An optional delegation method that is fired when the An optional delegation method that is fired when the
SideNavigationViewController pan gesture changes position. SideNavigationBarViewController pan gesture changes position.
*/ */
func sideNavigationViewPanDidChange(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition) { func sideNavigationViewPanDidChange(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition) {
print("Pan did change for", .Left == position ? "Left" : "Right", "view.") print("Pan did change for", .Left == position ? "Left" : "Right", "view.")
} }
/** /**
An optional delegation method that is fired when the An optional delegation method that is fired when the
SideNavigationViewController pan gesture ends. SideNavigationBarViewController pan gesture ends.
*/ */
func sideNavigationViewPanDidEnd(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition) { func sideNavigationViewPanDidEnd(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition) {
print("Pan did end for", .Left == position ? "Left" : "Right", "view.") print("Pan did end for", .Left == position ? "Left" : "Right", "view.")
} }
/** /**
An optional delegation method that is fired when the An optional delegation method that is fired when the
SideNavigationViewController tap gesture executes. SideNavigationBarViewController tap gesture executes.
*/ */
func sideNavigationViewDidTap(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition) { func sideNavigationViewDidTap(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition) {
print("Did Tap for", .Left == position ? "Left" : "Right", "view.") print("Did Tap for", .Left == position ? "Left" : "Right", "view.")
} }
} }
...@@ -53,10 +53,10 @@ class FeedViewController: UIViewController { ...@@ -53,10 +53,10 @@ class FeedViewController: UIViewController {
/** /**
Handles the search button click, which opens the Handles the search button click, which opens the
SideNavigationViewController. SideNavigationBarViewController.
*/ */
func handleSearchButton() { func handleSearchButton() {
sideNavigationViewController?.openRightView() sideNavigationBarViewController?.openRightView()
} }
/// Prepares view. /// Prepares view.
...@@ -130,7 +130,7 @@ extension FeedViewController: UITableViewDataSource { ...@@ -130,7 +130,7 @@ extension FeedViewController: UITableViewDataSource {
header.addSubview(label) header.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false label.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(header, child: label, left: navigationViewController!.navigationBarView.contentInset.left + navigationViewController!.navigationBarView.spacing) MaterialLayout.alignToParent(header, child: label, left: navigationBarViewController!.navigationBarView.contentInset.left + navigationBarViewController!.navigationBarView.spacing)
return header return header
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
/* /*
The following is an example of setting a UITableView as the LeftViewController The following is an example of setting a UITableView as the LeftViewController
within a SideNavigationViewController. within a SideNavigationBarViewController.
*/ */
import UIKit import UIKit
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
/* /*
The following is an example of setting a UITableView as the RightViewController The following is an example of setting a UITableView as the RightViewController
within a SideNavigationViewController. within a SideNavigationBarViewController.
*/ */
import UIKit import UIKit
......
...@@ -43,9 +43,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -43,9 +43,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let mainViewController = storyboard.instantiateViewControllerWithIdentifier("MainViewController") as! MainViewController let mainViewController = storyboard.instantiateViewControllerWithIdentifier("MainViewController") as! MainViewController
let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideViewController") as! SideViewController let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideViewController") as! SideViewController
// Configure the window with the SideNavigationViewController as the root view controller // Configure the window with the SideNavigationBarViewController as the root view controller
window = UIWindow(frame: UIScreen.mainScreen().bounds) window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = SideNavigationViewController(mainViewController: mainViewController, leftViewController: sideViewController) window?.rootViewController = SideNavigationBarViewController(mainViewController: mainViewController, leftViewController: sideViewController)
window?.makeKeyAndVisible() window?.makeKeyAndVisible()
return true return true
} }
......
...@@ -36,7 +36,7 @@ class MainViewController: UIViewController { ...@@ -36,7 +36,7 @@ class MainViewController: UIViewController {
super.viewDidLoad() super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib. // Do any additional setup after loading the view, typically from a nib.
// Toggle SideNavigationViewController. // Toggle SideNavigationBarViewController.
let img: UIImage? = UIImage(named: "ic_create_white") let img: UIImage? = UIImage(named: "ic_create_white")
let fabButton: FabButton = FabButton() let fabButton: FabButton = FabButton()
fabButton.setImage(img, forState: .Normal) fabButton.setImage(img, forState: .Normal)
...@@ -51,7 +51,7 @@ class MainViewController: UIViewController { ...@@ -51,7 +51,7 @@ class MainViewController: UIViewController {
// FabButton handler. // FabButton handler.
func handleFabButton() { func handleFabButton() {
sideNavigationViewController?.toggleLeftView() sideNavigationBarViewController?.toggleLeftView()
} }
} }
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
96A71EBB1C6FCFA300C0C4AE /* MenuView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96A71E901C6FBC2200C0C4AE /* MenuView.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96A71EBB1C6FCFA300C0C4AE /* MenuView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96A71E901C6FBC2200C0C4AE /* MenuView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96A71EC71C6FFF0500C0C4AE /* MaterialSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EC61C6FFF0500C0C4AE /* MaterialSwitch.swift */; }; 96A71EC71C6FFF0500C0C4AE /* MaterialSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EC61C6FFF0500C0C4AE /* MaterialSwitch.swift */; };
96A71EF61C71127100C0C4AE /* SearchBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EF51C71127100C0C4AE /* SearchBarView.swift */; }; 96A71EF61C71127100C0C4AE /* SearchBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71EF51C71127100C0C4AE /* SearchBarView.swift */; };
96A71F301C72E41100C0C4AE /* NavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F2F1C72E41100C0C4AE /* NavigationViewController.swift */; }; 96A71F301C72E41100C0C4AE /* NavigationBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F2F1C72E41100C0C4AE /* NavigationBarViewController.swift */; };
96A71F451C74ABCB00C0C4AE /* MaterialBorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F441C74ABCB00C0C4AE /* MaterialBorder.swift */; }; 96A71F451C74ABCB00C0C4AE /* MaterialBorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71F441C74ABCB00C0C4AE /* MaterialBorder.swift */; };
96A71FB31C764E3200C0C4AE /* StatusBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71FB21C764E3200C0C4AE /* StatusBarView.swift */; }; 96A71FB31C764E3200C0C4AE /* StatusBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71FB21C764E3200C0C4AE /* StatusBarView.swift */; };
96A71FB61C7651AA00C0C4AE /* ControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71FB01C7649F800C0C4AE /* ControlView.swift */; }; 96A71FB61C7651AA00C0C4AE /* ControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71FB01C7649F800C0C4AE /* ControlView.swift */; };
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
96A71E901C6FBC2200C0C4AE /* MenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuView.swift; sourceTree = "<group>"; }; 96A71E901C6FBC2200C0C4AE /* MenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuView.swift; sourceTree = "<group>"; };
96A71EC61C6FFF0500C0C4AE /* MaterialSwitch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialSwitch.swift; sourceTree = "<group>"; }; 96A71EC61C6FFF0500C0C4AE /* MaterialSwitch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialSwitch.swift; sourceTree = "<group>"; };
96A71EF51C71127100C0C4AE /* SearchBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBarView.swift; sourceTree = "<group>"; }; 96A71EF51C71127100C0C4AE /* SearchBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBarView.swift; sourceTree = "<group>"; };
96A71F2F1C72E41100C0C4AE /* NavigationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationViewController.swift; sourceTree = "<group>"; }; 96A71F2F1C72E41100C0C4AE /* NavigationBarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationBarViewController.swift; sourceTree = "<group>"; };
96A71F441C74ABCB00C0C4AE /* MaterialBorder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialBorder.swift; sourceTree = "<group>"; }; 96A71F441C74ABCB00C0C4AE /* MaterialBorder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialBorder.swift; sourceTree = "<group>"; };
96A71FB01C7649F800C0C4AE /* ControlView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlView.swift; sourceTree = "<group>"; }; 96A71FB01C7649F800C0C4AE /* ControlView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlView.swift; sourceTree = "<group>"; };
96A71FB21C764E3200C0C4AE /* StatusBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusBarView.swift; sourceTree = "<group>"; }; 96A71FB21C764E3200C0C4AE /* StatusBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusBarView.swift; sourceTree = "<group>"; };
...@@ -464,7 +464,7 @@ ...@@ -464,7 +464,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96D88C151C1328D800B91418 /* NavigationBarView.swift */, 96D88C151C1328D800B91418 /* NavigationBarView.swift */,
96A71F2F1C72E41100C0C4AE /* NavigationViewController.swift */, 96A71F2F1C72E41100C0C4AE /* NavigationBarViewController.swift */,
96D88C1D1C1328D800B91418 /* SideNavigationViewController.swift */, 96D88C1D1C1328D800B91418 /* SideNavigationViewController.swift */,
); );
name = Navigation; name = Navigation;
...@@ -672,7 +672,7 @@ ...@@ -672,7 +672,7 @@
96D88C2D1C1328D800B91418 /* MaterialDepth.swift in Sources */, 96D88C2D1C1328D800B91418 /* MaterialDepth.swift in Sources */,
96D88C331C1328D800B91418 /* MaterialLabel.swift in Sources */, 96D88C331C1328D800B91418 /* MaterialLabel.swift in Sources */,
96D88C281C1328D800B91418 /* MaterialAnimation.swift in Sources */, 96D88C281C1328D800B91418 /* MaterialAnimation.swift in Sources */,
96A71F301C72E41100C0C4AE /* NavigationViewController.swift in Sources */, 96A71F301C72E41100C0C4AE /* NavigationBarViewController.swift in Sources */,
960B232E1C383EAA00E96216 /* Material+UIImage.swift in Sources */, 960B232E1C383EAA00E96216 /* Material+UIImage.swift in Sources */,
96D88C451C1328D800B91418 /* RobotoFont.swift in Sources */, 96D88C451C1328D800B91418 /* RobotoFont.swift in Sources */,
96D88C1F1C1328D800B91418 /* CardView.swift in Sources */, 96D88C1F1C1328D800B91418 /* CardView.swift in Sources */,
......
...@@ -30,6 +30,10 @@ ...@@ -30,6 +30,10 @@
import UIKit import UIKit
@objc(NavigationBarViewDelegate)
public protocol NavigationBarViewDelegate : StatusBarViewDelegate {}
public class NavigationBarView : StatusBarView { public class NavigationBarView : StatusBarView {
/// Title label. /// Title label.
public var titleLabel: UILabel? { public var titleLabel: UILabel? {
...@@ -124,12 +128,6 @@ public class NavigationBarView : StatusBarView { ...@@ -124,12 +128,6 @@ public class NavigationBarView : StatusBarView {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
depth = .Depth1
grid.spacing = 8
grid.contentInset.left = 8
grid.contentInset.bottom = 8
grid.contentInset.right = 8
grid.axis.inherited = false
contentView.grid.axis.direction = .Vertical contentView.grid.axis.direction = .Vertical
} }
......
...@@ -32,15 +32,15 @@ import UIKit ...@@ -32,15 +32,15 @@ import UIKit
public extension UIViewController { public extension UIViewController {
/** /**
A convenience property that provides access to the NavigationViewController. A convenience property that provides access to the NavigationBarViewController.
This is the recommended method of accessing the NavigationViewController This is the recommended method of accessing the NavigationBarViewController
through child UIViewControllers. through child UIViewControllers.
*/ */
public var navigationViewController: NavigationViewController? { public var navigationBarViewController: NavigationBarViewController? {
var viewController: UIViewController? = self var viewController: UIViewController? = self
while nil != viewController { while nil != viewController {
if viewController is NavigationViewController { if viewController is NavigationBarViewController {
return viewController as? NavigationViewController return viewController as? NavigationBarViewController
} }
viewController = viewController?.parentViewController viewController = viewController?.parentViewController
} }
...@@ -48,7 +48,7 @@ public extension UIViewController { ...@@ -48,7 +48,7 @@ public extension UIViewController {
} }
} }
public class NavigationViewController: UIViewController { public class NavigationBarViewController: UIViewController {
public private(set) lazy var navigationBarView: NavigationBarView = NavigationBarView() public private(set) lazy var navigationBarView: NavigationBarView = NavigationBarView()
/** /**
...@@ -73,7 +73,7 @@ public class NavigationViewController: UIViewController { ...@@ -73,7 +73,7 @@ public class NavigationViewController: UIViewController {
public private(set) var mainViewController: UIViewController! public private(set) var mainViewController: UIViewController!
/** /**
An initializer for the NavigationViewController. An initializer for the NavigationBarViewController.
- Parameter mainViewController: The main UIViewController. - Parameter mainViewController: The main UIViewController.
*/ */
public convenience init(mainViewController: UIViewController) { public convenience init(mainViewController: UIViewController) {
...@@ -120,7 +120,7 @@ public class NavigationViewController: UIViewController { ...@@ -120,7 +120,7 @@ public class NavigationViewController: UIViewController {
}) })
} }
/// A method that generally prepares the NavigationViewController. /// A method that generally prepares the NavigationBarViewController.
private func prepareView() { private func prepareView() {
prepareNavigationBarView() prepareNavigationBarView()
prepareMainViewController() prepareMainViewController()
...@@ -139,7 +139,7 @@ public class NavigationViewController: UIViewController { ...@@ -139,7 +139,7 @@ public class NavigationViewController: UIViewController {
/** /**
A method that adds the passed in controller as a child of A method that adds the passed in controller as a child of
the NavigationViewController within the passed in the NavigationBarViewController within the passed in
container view. container view.
- Parameter viewController: A UIViewController to add as a child. - Parameter viewController: A UIViewController to add as a child.
- Parameter container: A UIView that is the parent of the - Parameter container: A UIView that is the parent of the
...@@ -161,7 +161,7 @@ public class NavigationViewController: UIViewController { ...@@ -161,7 +161,7 @@ public class NavigationViewController: UIViewController {
} }
} }
extension NavigationViewController : StatusBarViewDelegate { extension NavigationBarViewController : NavigationBarViewDelegate {
/// Monitor layout changes. /// Monitor layout changes.
public func statusBarViewDidChangeLayout(statusBarView: StatusBarView) { public func statusBarViewDidChangeLayout(statusBarView: StatusBarView) {
layoutSubviews() layoutSubviews()
......
...@@ -94,6 +94,12 @@ public class StatusBarView : ControlView { ...@@ -94,6 +94,12 @@ public class StatusBarView : ControlView {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
depth = .Depth1
oldFrame = frame oldFrame = frame
grid.spacing = 8
grid.contentInset.left = 8
grid.contentInset.bottom = 8
grid.contentInset.right = 8
grid.axis.inherited = false
} }
} }
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