Commit dfd7d96e by Daniel Dahan

updated NavigationBarViewController Example

parent f83591e9
......@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
9612606B1C78E92000BF0079 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9612606A1C78E92000BF0079 /* Material.framework */; };
9612606C1C78E92000BF0079 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9612606A1C78E92000BF0079 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9656CD211C6CFA6200EBCEF1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9656CD201C6CFA6200EBCEF1 /* AppDelegate.swift */; };
9656CD231C6CFA6200EBCEF1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9656CD221C6CFA6200EBCEF1 /* ViewController.swift */; };
9656CD281C6CFA6200EBCEF1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9656CD271C6CFA6200EBCEF1 /* Assets.xcassets */; };
......@@ -20,6 +22,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
9612606C1C78E92000BF0079 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
9612606A1C78E92000BF0079 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
9656CD1D1C6CFA6200EBCEF1 /* Grid.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Grid.app; sourceTree = BUILT_PRODUCTS_DIR; };
9656CD201C6CFA6200EBCEF1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
9656CD221C6CFA6200EBCEF1 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
......@@ -40,6 +44,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9612606B1C78E92000BF0079 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -49,6 +54,7 @@
9656CD141C6CFA6200EBCEF1 = {
isa = PBXGroup;
children = (
9612606A1C78E92000BF0079 /* Material.framework */,
9656CD1F1C6CFA6200EBCEF1 /* Grid */,
9656CD1E1C6CFA6200EBCEF1 /* Products */,
);
......
......@@ -40,10 +40,10 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
// prepareHorizontalGridViewExample()
prepareHorizontalGridViewExample()
// prepareVerticalGridViewExample()
// prepareGridDirectionNoneExample()
prepareSmallCardViewExample()
// prepareSmallCardViewExample()
// prepareMediumCardViewExample()
// prepareLargeCardViewExample()
}
......@@ -83,23 +83,49 @@ class ViewController: UIViewController {
btn3.setImage(image, forState: .Highlighted)
view.addSubview(btn3)
btn1.grid.columns = 3
btn1.grid.rows = 2
btn2.grid.columns = 3
btn2.grid.rows = 2
btn3.grid.columns = 3
view.grid.columns = 9
btn3.grid.rows = 2
//
// view.grid.columns = 9
view.grid.axis.rows = 6
view.grid.spacing = 16
view.grid.axis.direction = .Vertical
view.grid.contentInset.left = 16
view.grid.contentInset.right = 16
view.grid.contentInset.top = 100
view.grid.contentInset.bottom = 100
view.grid.views = [btn1, btn2, btn3]
// view.grid.contentInset.bottom = 100
view.grid.views = [btn2, btn1, btn3]
btn2.backgroundColor = MaterialColor.blue.darken1
for v in view.grid.views! {
print(v.frame)
}
let menuButton: FabButton = FabButton()
let mb1: FabButton = FabButton()
let mb2: FabButton = FabButton()
let mb3: FabButton = FabButton()
let menuView: MenuView = MenuView()
menuView.addSubview(mb1)
menuView.addSubview(mb2)
menuView.addSubview(mb3)
// Initialize the menu and setup the configuration options.
menuView.menu.direction = .Up
// menuView.menu.baseViewSize = CGSizeMake(56, 56)
menuView.menu.views = [menuButton, mb1, mb2, mb3]
view.addSubview(menuView)
menuView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.size(view, child: menuView, width: 56, height: 56)
MaterialLayout.alignFromBottomLeft(view, child: menuView, bottom: 16, left: (view.bounds.width - 56) / 2)
menuView.backgroundColor = MaterialColor.green.base
}
/// Prepares the Vertical GridView example.
......@@ -203,7 +229,7 @@ class ViewController: UIViewController {
image = UIImage(named: "ic_more_vert_white")?.imageWithRenderingMode(.AlwaysTemplate)
let moreButton: FlatButton = FlatButton()
moreButton.contentInsetPreset = .None
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
moreButton.tintColor = MaterialColor.blueGrey.darken4
moreButton.setImage(image, forState: .Normal)
......@@ -228,7 +254,7 @@ class ViewController: UIViewController {
image = UIImage(named: "ic_alarm_white")?.imageWithRenderingMode(.AlwaysTemplate)
let alarmButton: FlatButton = FlatButton()
alarmButton.contentInsetPreset = .None
alarmButton.contentEdgeInsetsPreset = .None
alarmButton.pulseColor = MaterialColor.blueGrey.darken4
alarmButton.tintColor = MaterialColor.red.base
alarmButton.setImage(image, forState: .Normal)
......@@ -301,7 +327,7 @@ class ViewController: UIViewController {
image = UIImage(named: "ic_more_vert_white")?.imageWithRenderingMode(.AlwaysTemplate)
let moreButton: FlatButton = FlatButton()
moreButton.contentInsetPreset = .None
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
moreButton.tintColor = MaterialColor.blueGrey.darken4
moreButton.setImage(image, forState: .Normal)
......@@ -326,7 +352,7 @@ class ViewController: UIViewController {
image = UIImage(named: "ic_alarm_white")?.imageWithRenderingMode(.AlwaysTemplate)
let alarmButton: FlatButton = FlatButton()
alarmButton.contentInsetPreset = .None
alarmButton.contentEdgeInsetsPreset = .None
alarmButton.pulseColor = MaterialColor.blueGrey.darken4
alarmButton.tintColor = MaterialColor.red.base
alarmButton.setImage(image, forState: .Normal)
......@@ -411,7 +437,7 @@ class ViewController: UIViewController {
image = UIImage(named: "ic_more_horiz_white")?.imageWithRenderingMode(.AlwaysTemplate)
let moreButton: FlatButton = FlatButton()
moreButton.contentInsetPreset = .None
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
moreButton.tintColor = MaterialColor.blueGrey.darken4
moreButton.setImage(image, forState: .Normal)
......@@ -436,7 +462,7 @@ class ViewController: UIViewController {
image = UIImage(named: "ic_alarm_white")?.imageWithRenderingMode(.AlwaysTemplate)
let alarmButton: FlatButton = FlatButton()
alarmButton.contentInsetPreset = .None
alarmButton.contentEdgeInsetsPreset = .None
alarmButton.pulseColor = MaterialColor.blueGrey.darken4
alarmButton.tintColor = MaterialColor.red.base
alarmButton.setImage(image, forState: .Normal)
......
......@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
961260711C78EFE500BF0079 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 961260701C78EFE500BF0079 /* Material.framework */; };
961260721C78EFE500BF0079 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 961260701C78EFE500BF0079 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96D88C831C132C1800B91418 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C821C132C1800B91418 /* AppDelegate.swift */; };
96D88C851C132C1800B91418 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C841C132C1800B91418 /* ViewController.swift */; };
96D88C8A1C132C1800B91418 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96D88C891C132C1800B91418 /* Assets.xcassets */; };
......@@ -20,6 +22,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
961260721C78EFE500BF0079 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
961260701C78EFE500BF0079 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
96D88C7F1C132C1800B91418 /* NavigationBarView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NavigationBarView.app; sourceTree = BUILT_PRODUCTS_DIR; };
96D88C821C132C1800B91418 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96D88C841C132C1800B91418 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
......@@ -40,6 +44,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
961260711C78EFE500BF0079 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -49,6 +54,7 @@
96D88C761C132C1800B91418 = {
isa = PBXGroup;
children = (
961260701C78EFE500BF0079 /* Material.framework */,
96D88C811C132C1800B91418 /* NavigationBarView */,
96D88C801C132C1800B91418 /* Products */,
);
......
......@@ -76,10 +76,10 @@ class ViewController: UIViewController {
menuButton.pulseScale = false
menuButton.setImage(image, forState: .Normal)
menuButton.setImage(image, forState: .Highlighted)
//
// Switch control.
let switchControl: MaterialSwitch = MaterialSwitch(state: .Off, style: .LightContent, size: .Small)
//
// Search button.
image = UIImage(named: "ic_search_white")
let searchButton: FlatButton = FlatButton()
......
......@@ -7,11 +7,18 @@
objects = {
/* Begin PBXBuildFile section */
9600361B1C7828BB00EBA579 /* BlueViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9600361A1C7828BB00EBA579 /* BlueViewController.swift */; };
9600361D1C7829EF00EBA579 /* GreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9600361C1C7829EF00EBA579 /* GreenViewController.swift */; };
9626C2E01C7950AB007CA8E0 /* AppMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9626C2DF1C7950AB007CA8E0 /* AppMenuViewController.swift */; };
9626C2E21C795717007CA8E0 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9626C2E11C795717007CA8E0 /* AppLeftViewController.swift */; };
9626C2E41C79594B007CA8E0 /* AppRightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9626C2E31C79594B007CA8E0 /* AppRightViewController.swift */; };
9626C2E61C7962B5007CA8E0 /* SearchListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9626C2E51C7962B5007CA8E0 /* SearchListViewController.swift */; };
9626C2E81C7962D5007CA8E0 /* AppSearchBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9626C2E71C7962D5007CA8E0 /* AppSearchBarViewController.swift */; };
96A71FC41C765FDF00C0C4AE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71FC31C765FDF00C0C4AE /* AppDelegate.swift */; };
96A71FC61C765FDF00C0C4AE /* AppNavigationBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71FC51C765FDF00C0C4AE /* AppNavigationBarViewController.swift */; };
96A71FCB1C765FDF00C0C4AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96A71FCA1C765FDF00C0C4AE /* Assets.xcassets */; };
96A71FCE1C765FDF00C0C4AE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96A71FCC1C765FDF00C0C4AE /* LaunchScreen.storyboard */; };
96A71FD61C76618D00C0C4AE /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71FD51C76618D00C0C4AE /* MainViewController.swift */; };
96A71FD61C76618D00C0C4AE /* FeedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A71FD51C76618D00C0C4AE /* FeedViewController.swift */; };
96A7200C1C76E53A00C0C4AE /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96A7200B1C76E53A00C0C4AE /* Material.framework */; };
96A7200D1C76E53A00C0C4AE /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96A7200B1C76E53A00C0C4AE /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
......@@ -31,13 +38,20 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
9600361A1C7828BB00EBA579 /* BlueViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlueViewController.swift; sourceTree = "<group>"; };
9600361C1C7829EF00EBA579 /* GreenViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GreenViewController.swift; sourceTree = "<group>"; };
9626C2DF1C7950AB007CA8E0 /* AppMenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppMenuViewController.swift; sourceTree = "<group>"; };
9626C2E11C795717007CA8E0 /* AppLeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; };
9626C2E31C79594B007CA8E0 /* AppRightViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppRightViewController.swift; sourceTree = "<group>"; };
9626C2E51C7962B5007CA8E0 /* SearchListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchListViewController.swift; sourceTree = "<group>"; };
9626C2E71C7962D5007CA8E0 /* AppSearchBarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppSearchBarViewController.swift; sourceTree = "<group>"; };
96A71FC01C765FDF00C0C4AE /* NavigationBarViewController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NavigationBarViewController.app; sourceTree = BUILT_PRODUCTS_DIR; };
96A71FC31C765FDF00C0C4AE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96A71FC51C765FDF00C0C4AE /* AppNavigationBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppNavigationBarViewController.swift; sourceTree = "<group>"; };
96A71FCA1C765FDF00C0C4AE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
96A71FCD1C765FDF00C0C4AE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
96A71FCF1C765FDF00C0C4AE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
96A71FD51C76618D00C0C4AE /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
96A71FD51C76618D00C0C4AE /* FeedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedViewController.swift; sourceTree = "<group>"; };
96A7200B1C76E53A00C0C4AE /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
......@@ -75,7 +89,14 @@
children = (
96A71FC31C765FDF00C0C4AE /* AppDelegate.swift */,
96A71FC51C765FDF00C0C4AE /* AppNavigationBarViewController.swift */,
96A71FD51C76618D00C0C4AE /* MainViewController.swift */,
9626C2E71C7962D5007CA8E0 /* AppSearchBarViewController.swift */,
9626C2DF1C7950AB007CA8E0 /* AppMenuViewController.swift */,
9626C2E11C795717007CA8E0 /* AppLeftViewController.swift */,
9626C2E31C79594B007CA8E0 /* AppRightViewController.swift */,
96A71FD51C76618D00C0C4AE /* FeedViewController.swift */,
9600361A1C7828BB00EBA579 /* BlueViewController.swift */,
9600361C1C7829EF00EBA579 /* GreenViewController.swift */,
9626C2E51C7962B5007CA8E0 /* SearchListViewController.swift */,
96A71FCA1C765FDF00C0C4AE /* Assets.xcassets */,
96A71FCC1C765FDF00C0C4AE /* LaunchScreen.storyboard */,
96A71FCF1C765FDF00C0C4AE /* Info.plist */,
......@@ -154,9 +175,16 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
96A71FD61C76618D00C0C4AE /* MainViewController.swift in Sources */,
9600361B1C7828BB00EBA579 /* BlueViewController.swift in Sources */,
9626C2E61C7962B5007CA8E0 /* SearchListViewController.swift in Sources */,
9626C2E21C795717007CA8E0 /* AppLeftViewController.swift in Sources */,
96A71FD61C76618D00C0C4AE /* FeedViewController.swift in Sources */,
9626C2E81C7962D5007CA8E0 /* AppSearchBarViewController.swift in Sources */,
9600361D1C7829EF00EBA579 /* GreenViewController.swift in Sources */,
96A71FC61C765FDF00C0C4AE /* AppNavigationBarViewController.swift in Sources */,
9626C2E41C79594B007CA8E0 /* AppRightViewController.swift in Sources */,
96A71FC41C765FDF00C0C4AE /* AppDelegate.swift in Sources */,
9626C2E01C7950AB007CA8E0 /* AppMenuViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = AppNavigationBarViewController(mainViewController: MainViewController())
window!.rootViewController = SideNavigationViewController(mainViewController: AppMenuViewController(mainViewController: AppNavigationBarViewController(mainViewController: FeedViewController())), leftViewController: AppLeftViewController(), rightViewController: AppRightViewController())
window!.makeKeyAndVisible()
return true
}
......
/*
* 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 Material 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.
*/
/*
The following is an example of setting a UITableView as the LeftViewController
within a SideNavigationViewController.
*/
import UIKit
import Material
private struct Cell {
var text: String
var imageName: String
var selected: Bool
}
class AppLeftViewController: UIViewController {
/// A tableView used to display navigation items.
private let tableView: UITableView = UITableView()
/// A list of all the navigation items.
private var items: Array<Cell> = Array<Cell>()
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareCells()
prepareTableView()
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
/*
The dimensions of the view will not be updated by the side navigation
until the view appears, so loading a dyanimc width is better done here.
The user will not see this, as it is hidden, by the drawer being closed
when launching the app. There are other strategies to mitigate from this.
This is one approach that works nicely here.
*/
prepareProfileView()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.blueGrey.darken4
}
/// Prepares the items that are displayed within the tableView.
private func prepareCells() {
items.append(Cell(text: "Inbox", imageName: "ic_inbox", selected: true))
items.append(Cell(text: "Today", imageName: "ic_today", selected: false))
items.append(Cell(text: "Bookmarks", imageName: "ic_book", selected: false))
items.append(Cell(text: "Work", imageName: "ic_work", selected: false))
items.append(Cell(text: "Contacts", imageName: "ic_contacts", selected: false))
items.append(Cell(text: "Settings", imageName: "ic_settings", selected: false))
}
/// Prepares profile view.
private func prepareProfileView() {
let backgroundView: MaterialView = MaterialView()
backgroundView.image = UIImage(named: "MaterialBackground")
let profileView: MaterialView = MaterialView()
profileView.image = UIImage(named: "Profile9")?.resize(toWidth: 72)
profileView.backgroundColor = MaterialColor.clear
profileView.shape = .Circle
profileView.borderColor = MaterialColor.white
profileView.borderWidth = 3
view.addSubview(profileView)
let nameLabel: UILabel = UILabel()
nameLabel.text = "Michael Smith"
nameLabel.textColor = MaterialColor.white
nameLabel.font = RobotoFont.mediumWithSize(18)
view.addSubview(nameLabel)
profileView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromTopLeft(view, child: profileView, top: 30, left: (view.bounds.width - 72) / 2)
MaterialLayout.size(view, child: profileView, width: 72, height: 72)
nameLabel.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromTop(view, child: nameLabel, top: 130)
MaterialLayout.alignToParentHorizontally(view, child: nameLabel, left: 20, right: 20)
}
/// Prepares the tableView.
private func prepareTableView() {
tableView.registerClass(MaterialTableViewCell.self, forCellReuseIdentifier: "MaterialTableViewCell")
tableView.backgroundColor = MaterialColor.clear
tableView.dataSource = self
tableView.delegate = self
tableView.separatorStyle = .None
// Use MaterialLayout to easily align the tableView.
view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(view, child: tableView, top: 170)
}
}
/// TableViewDataSource methods.
extension AppLeftViewController: UITableViewDataSource {
/// Determines the number of rows in the tableView.
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count;
}
/// Prepares the cells within the tableView.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: MaterialTableViewCell = tableView.dequeueReusableCellWithIdentifier("MaterialTableViewCell", forIndexPath: indexPath) as! MaterialTableViewCell
cell.backgroundColor = MaterialColor.clear
let item: Cell = items[indexPath.row]
cell.textLabel!.text = item.text
cell.textLabel!.font = RobotoFont.medium
cell.imageView!.image = UIImage(named: item.imageName)?.imageWithRenderingMode(.AlwaysTemplate)
cell.imageView!.tintColor = MaterialColor.grey.lighten2
cell.textLabel!.textColor = item.selected ? MaterialColor.cyan.lighten5 : MaterialColor.grey.lighten3
return cell
}
}
/// UITableViewDelegate methods.
extension AppLeftViewController: UITableViewDelegate {
/// Sets the tableView cell height.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 64
}
/// Select item at row in tableView.
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("Cell selected")
}
}
/*
* 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 GraphKit 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.
*/
/*
The following is an example of using a MenuViewController to control the
flow of your application.
*/
import UIKit
import Material
class AppMenuViewController: MenuViewController {
/// MenuView diameter.
private let baseViewSize: CGSize = CGSizeMake(56, 56)
/// MenuView inset.
private let menuViewInset: CGFloat = 16
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareMenuView()
}
/**
*/
func handleBtn2() {
if navigationBarViewController?.mainViewController is BlueViewController {
return
}
handleMenu()
menuViewController?.transitionFromMainViewController(BlueViewController())
navigationBarViewController?.navigationBarView.titleLabel?.text = "Blue"
}
/**
*/
func handleBtn3() {
if navigationBarViewController?.mainViewController is GreenViewController {
return
}
handleMenu()
menuViewController?.transitionFromMainViewController(GreenViewController())
navigationBarViewController?.navigationBarView.titleLabel?.text = "Green"
}
/**
*/
func handleBtn4() {
if navigationBarViewController?.mainViewController is FeedViewController {
return
}
handleMenu()
menuViewController?.transitionFromMainViewController(AppNavigationBarViewController(mainViewController: FeedViewController()))
navigationBarViewController?.navigationBarView.titleLabel?.text = "Feed"
}
/// Handle the menuView touch event.
func handleMenu() {
var rotate: Double = -0.125
if true == menuView.menu.opened {
hideMenuBackdrop()
menuView.menu.close()
} else {
showMenuBackdrop()
rotate = 0.125
menuView.menu.open() { (v: UIView) in
(v as? MaterialButton)?.pulse()
}
}
(menuView.menu.views?.first as? MaterialButton)?.animate(MaterialAnimation.rotate(rotate))
}
/// Prepares view.
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/// Prepares the add button.
private func prepareMenuView() {
var image: UIImage? = UIImage(named: "ic_add_white")
let btn1: FabButton = FabButton()
btn1.setImage(image, forState: .Normal)
btn1.setImage(image, forState: .Highlighted)
btn1.addTarget(self, action: "handleMenu", forControlEvents: .TouchUpInside)
menuView.addSubview(btn1)
image = UIImage(named: "ic_create_white")
let btn2: FabButton = FabButton()
btn2.backgroundColor = MaterialColor.blue.base
btn2.setImage(image, forState: .Normal)
btn2.setImage(image, forState: .Highlighted)
menuView.addSubview(btn2)
btn2.addTarget(self, action: "handleBtn2", forControlEvents: .TouchUpInside)
image = UIImage(named: "ic_photo_camera_white")
let btn3: FabButton = FabButton()
btn3.backgroundColor = MaterialColor.green.base
btn3.setImage(image, forState: .Normal)
btn3.setImage(image, forState: .Highlighted)
menuView.addSubview(btn3)
btn3.addTarget(self, action: "handleBtn3", forControlEvents: .TouchUpInside)
image = UIImage(named: "ic_note_add_white")
let btn4: FabButton = FabButton()
btn4.backgroundColor = MaterialColor.yellow.base
btn4.setImage(image, forState: .Normal)
btn4.setImage(image, forState: .Highlighted)
menuView.addSubview(btn4)
btn4.addTarget(self, action: "handleBtn4", forControlEvents: .TouchUpInside)
// Initialize the menu and setup the configuration options.
menuView.menu.direction = .Up
menuView.menu.baseViewSize = baseViewSize
menuView.menu.views = [btn1, btn2, btn3, btn4]
view.addSubview(menuView)
menuView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.size(view, child: menuView, width: baseViewSize.width, height: baseViewSize.height)
MaterialLayout.alignFromBottomRight(view, child: menuView, bottom: menuViewInset, right: menuViewInset)
}
/// Displays the menuBackdrop.
private func showMenuBackdrop() {
// Disable the side nav, so users can't swipe while viewing the menu.
sideNavigationViewController?.enabled = false
navigationBarViewController?.navigationBarView.userInteractionEnabled = false
navigationBarViewController?.navigationBarView.alpha = 0.5
menuViewController?.mainViewController.view.userInteractionEnabled = false
menuViewController?.mainViewController.view.alpha = 0.5
}
/// Hides the menuBackdrop.
private func hideMenuBackdrop() {
// Enable the side nav.
sideNavigationViewController?.enabled = true
navigationBarViewController?.navigationBarView.userInteractionEnabled = true
navigationBarViewController?.navigationBarView.alpha = 1
menuViewController?.mainViewController.view.userInteractionEnabled = true
menuViewController?.mainViewController.view.alpha = 1
}
}
......@@ -37,77 +37,58 @@ import UIKit
import Material
class AppNavigationBarViewController: NavigationBarViewController {
/// Menu backdrop layer.
private lazy var menuBackdropLayer: MaterialLayer = MaterialLayer()
/// MenuView diameter.
private let menuViewDiameter: CGFloat = 56
/// MenuView inset.
private let menuViewInset: CGFloat = 16
/// MenuView.
private let menuView: MenuView = MenuView()
override var floatingViewController: UIViewController? {
didSet {
if nil == floatingViewController {
/*
To lighten the status bar - add the
"View controller-based status bar appearance = NO"
to your info.plist file and set the following property.
*/
navigationBarView.statusBarStyle = .LightContent
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareNavigationBarView()
prepareMenuBackdropLayer()
prepareMenuView()
}
/**
Handles the menu button click, which opens the
SideNavigationBarViewController.
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
/*
To lighten the status bar - add the
"View controller-based status bar appearance = NO"
to your info.plist file and set the following property.
*/
func handleMenuButton() {
sideNavigationBarViewController?.openLeftView()
navigationBarView.statusBarStyle = .LightContent
}
/**
Handles the more button click, which opens the
SideNavigationBarViewController.
*/
func handleMoreButton() {
sideNavigationBarViewController?.openRightView()
/// Prepares view.
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/// Handle the menuView touch event.
func handleMenu() {
let image: UIImage?
if menuView.menu.opened {
hideMenuBackdropLayer()
menuView.menu.close()
image = UIImage(named: "ic_add_white")
} else {
showMenuBackdropLayer()
menuView.menu.open() { (v: UIView) in
(v as? MaterialButton)?.pulse()
}
image = UIImage(named: "ic_close_white")
/// Toggle SideNavigationViewController left UIViewController.
internal func handleMenuButton() {
sideNavigationViewController?.toggleLeftView()
}
// Add a nice rotation animation to the base button.
let first: MaterialButton? = menuView.menu.views?.first as? MaterialButton
first?.animate(MaterialAnimation.rotate(1))
first?.setImage(image, forState: .Normal)
first?.setImage(image, forState: .Highlighted)
/// Toggle SideNavigationViewController right UIViewController.
internal func handleSearchButton() {
guard let v: AppSearchBarViewController = AppSearchBarViewController(mainViewController: SearchListViewController()) else {
return
}
/// Prepares view.
private func prepareView() {
view.backgroundColor = MaterialColor.white
navigationBarViewController?.floatingViewController = v
}
/// Prepares the navigationBarView.
private func prepareNavigationBarView() {
// Title label.
let titleLabel: UILabel = UILabel()
titleLabel.text = "Inbox"
titleLabel.text = "Feed"
titleLabel.textAlignment = .Left
titleLabel.textColor = MaterialColor.white
titleLabel.font = RobotoFont.regularWithSize(20)
......@@ -135,107 +116,18 @@ class AppNavigationBarViewController: NavigationBarViewController {
let switchControl: MaterialSwitch = MaterialSwitch(state: .Off, style: .LightContent, size: .Small)
// Search button.
image = UIImage(named: "ic_more_horiz_white")
let moreButton: FlatButton = FlatButton()
moreButton.pulseColor = MaterialColor.white
moreButton.pulseScale = false
moreButton.setImage(image, forState: .Normal)
moreButton.setImage(image, forState: .Highlighted)
moreButton.addTarget(self, action: "handleMoreButton", forControlEvents: .TouchUpInside)
/*
To lighten the status bar - add the
"View controller-based status bar appearance = NO"
to your info.plist file and set the following property.
*/
navigationBarView.statusBarStyle = .LightContent
image = UIImage(named: "ic_search_white")
let searchButton: FlatButton = FlatButton()
searchButton.pulseColor = MaterialColor.white
searchButton.pulseScale = false
searchButton.setImage(image, forState: .Normal)
searchButton.setImage(image, forState: .Highlighted)
searchButton.addTarget(self, action: "handleSearchButton", forControlEvents: .TouchUpInside)
navigationBarView.backgroundColor = MaterialColor.blue.base
navigationBarView.titleLabel = titleLabel
navigationBarView.leftControls = [menuButton]
navigationBarView.rightControls = [switchControl, moreButton]
}
/// Prepares the menuBackdropLayer.
private func prepareMenuBackdropLayer() {
menuBackdropLayer.backgroundColor = MaterialColor.white.colorWithAlphaComponent(0.75).CGColor
menuBackdropLayer.hidden = true
menuBackdropLayer.zPosition = 2000
view.layer.addSublayer(menuBackdropLayer)
}
/// Prepares the add button.
private func prepareMenuView() {
var image: UIImage? = UIImage(named: "ic_add_white")
let btn1: FabButton = FabButton()
btn1.pulseColor = nil
btn1.setImage(image, forState: .Normal)
btn1.setImage(image, forState: .Highlighted)
btn1.addTarget(self, action: "handleMenu", forControlEvents: .TouchUpInside)
menuView.addSubview(btn1)
image = UIImage(named: "ic_create_white")
let btn2: FabButton = FabButton()
btn2.backgroundColor = MaterialColor.blue.base
btn2.setImage(image, forState: .Normal)
btn2.setImage(image, forState: .Highlighted)
menuView.addSubview(btn2)
image = UIImage(named: "ic_photo_camera_white")
let btn3: FabButton = FabButton()
btn3.backgroundColor = MaterialColor.green.base
btn3.setImage(image, forState: .Normal)
btn3.setImage(image, forState: .Highlighted)
menuView.addSubview(btn3)
image = UIImage(named: "ic_note_add_white")
let btn4: FabButton = FabButton()
btn4.backgroundColor = MaterialColor.amber.base
btn4.setImage(image, forState: .Normal)
btn4.setImage(image, forState: .Highlighted)
menuView.addSubview(btn4)
// Initialize the menu and setup the configuration options.
menuView.menu.direction = .Up
menuView.menu.baseViewSize = CGSizeMake(menuViewDiameter, menuViewDiameter)
menuView.menu.views = [btn1, btn2, btn3, btn4]
menuView.zPosition = 3000
view.insertSubview(menuView, aboveSubview: navigationBarView)
menuView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.size(view, child: menuView, width: menuViewDiameter, height: menuViewDiameter)
MaterialLayout.alignFromBottomRight(view, child: menuView, bottom: menuViewInset, right: menuViewInset)
}
/// Displays the menuBackdropLayer.
private func showMenuBackdropLayer() {
// Disable the side nav, so users can't swipe while viewing the menu.
sideNavigationBarViewController?.enabled = false
// Position the menuBackdropLayer for the animation when opening.
MaterialAnimation.animationDisabled { [unowned self] in
self.menuBackdropLayer.frame = self.menuView.frame
self.menuBackdropLayer.shape = .Circle
self.menuBackdropLayer.hidden = false
}
menuBackdropLayer.animate(MaterialAnimation.scale(30, duration: 0.25))
}
/// Hides the menuBackdropLayer.
private func hideMenuBackdropLayer() {
// Enable the side nav.
sideNavigationBarViewController?.enabled = true
// Position the menuBackdropLayer for the animation when closing.
menuBackdropLayer.animate(MaterialAnimation.animationGroup([
MaterialAnimation.scale(1),
MaterialAnimation.position(menuView.center)
], duration: 0.25))
MaterialAnimation.delay(0.25) { [weak self] in
self?.menuBackdropLayer.hidden = true
}
navigationBarView.rightControls = [switchControl, searchButton]
}
}
/*
* 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 Material 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.
*/
/*
The following is an example of setting a UITableView as the RightViewController
within a SideNavigationViewController.
*/
import UIKit
import Material
private struct Cell {
var text: String
var imageName: String
var selected: Bool
}
class AppRightViewController: UIViewController {
/// A tableView used to display navigation items.
private let tableView: UITableView = UITableView()
/// A list of all the navigation items.
private var items: Array<Cell> = Array<Cell>()
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareCells()
prepareTableView()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.blueGrey.darken4
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
}
/// Prepares the items that are displayed within the tableView.
private func prepareCells() {
items.append(Cell(text: "Inbox", imageName: "ic_inbox", selected: false))
items.append(Cell(text: "Today", imageName: "ic_today", selected: true))
items.append(Cell(text: "Bookmarks", imageName: "ic_book", selected: false))
items.append(Cell(text: "Work", imageName: "ic_work", selected: false))
items.append(Cell(text: "Contacts", imageName: "ic_contacts", selected: false))
items.append(Cell(text: "Settings", imageName: "ic_settings", selected: false))
}
/// Prepares the tableView.
private func prepareTableView() {
tableView.registerClass(MaterialTableViewCell.self, forCellReuseIdentifier: "MaterialTableViewCell")
tableView.backgroundColor = MaterialColor.clear
tableView.dataSource = self
tableView.delegate = self
tableView.separatorStyle = .None
// Use MaterialLayout to easily align the tableView.
view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(view, child: tableView)
}
}
/// TableViewDataSource methods.
extension AppRightViewController: UITableViewDataSource {
/// Determines the number of rows in the tableView.
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count;
}
/// Prepares the cells within the tableView.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: MaterialTableViewCell = tableView.dequeueReusableCellWithIdentifier("MaterialTableViewCell", forIndexPath: indexPath) as! MaterialTableViewCell
cell.backgroundColor = MaterialColor.clear
let item: Cell = items[indexPath.row]
cell.textLabel!.text = item.text
cell.textLabel!.font = RobotoFont.medium
cell.imageView!.image = UIImage(named: item.imageName)?.imageWithRenderingMode(.AlwaysTemplate)
cell.imageView!.tintColor = MaterialColor.grey.lighten2
cell.textLabel!.textColor = item.selected ? MaterialColor.cyan.lighten5 : MaterialColor.grey.lighten3
return cell
}
}
/// UITableViewDelegate methods.
extension AppRightViewController: UITableViewDelegate {
/// Sets the tableView cell height.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 64
}
/// Select item at row in tableView.
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("Cell selected")
}
}
/*
* 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 GraphKit 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.
*/
/*
The following is an example of using a SearchBarViewController to control the
flow of your application.
*/
import UIKit
import Material
class AppSearchBarViewController: SearchBarViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareSearchBarView()
}
/// Prepares view.
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/// Toggle SideSearchViewController left UIViewController.
internal func handleBackButton() {
navigationBarViewController?.floatingViewController = nil
}
/// Toggle SideSearchViewController right UIViewController.
internal func handleMoreButton() {
searchBarView.textField.resignFirstResponder()
sideNavigationViewController?.delegate = self
sideNavigationViewController?.enabledRightView = true
sideNavigationViewController?.toggleRightView()
}
/// Prepares the searchBarView.
private func prepareSearchBarView() {
var image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate)
let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = MaterialColor.blueGrey.darken4
clearButton.pulseScale = false
clearButton.tintColor = MaterialColor.blueGrey.darken4
clearButton.setImage(image, forState: .Normal)
clearButton.setImage(image, forState: .Highlighted)
// Back button.
image = UIImage(named: "ic_arrow_back_white")?.imageWithRenderingMode(.AlwaysTemplate)
let backButton: FlatButton = FlatButton()
backButton.pulseColor = MaterialColor.blueGrey.darken4
backButton.pulseScale = false
backButton.tintColor = MaterialColor.blueGrey.darken4
backButton.setImage(image, forState: .Normal)
backButton.setImage(image, forState: .Highlighted)
backButton.addTarget(self, action: "handleBackButton", forControlEvents: .TouchUpInside)
// Search button.
image = UIImage(named: "ic_more_horiz_white")?.imageWithRenderingMode(.AlwaysTemplate)
let searchButton: FlatButton = FlatButton()
searchButton.pulseColor = MaterialColor.blueGrey.darken4
searchButton.pulseScale = false
searchButton.tintColor = MaterialColor.blueGrey.darken4
searchButton.setImage(image, forState: .Normal)
searchButton.setImage(image, forState: .Highlighted)
searchButton.addTarget(self, action: "handleMoreButton", forControlEvents: .TouchUpInside)
/*
To lighten the status bar - add the
"View controller-based status bar appearance = NO"
to your info.plist file and set the following property.
*/
searchBarView.statusBarStyle = .Default
searchBarView.delegate = self
searchBarView.placeholder = "Search"
searchBarView.tintColor = MaterialColor.blueGrey.darken4
searchBarView.textColor = MaterialColor.blueGrey.darken4
searchBarView.placeholderTextColor = MaterialColor.blueGrey.darken4
searchBarView.textField.font = RobotoFont.regularWithSize(17)
searchBarView.clearButton = clearButton
searchBarView.leftControls = [backButton]
searchBarView.rightControls = [searchButton]
}
}
extension AppSearchBarViewController: SideNavigationViewControllerDelegate {
func sideNavigationViewWillClose(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition) {
sideNavigationViewController.enabledRightView = false
sideNavigationViewController.delegate = nil
searchBarView.textField.becomeFirstResponder()
}
}
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile1.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile2.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile3.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile4.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile5.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile6.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile7.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile8.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "Profile9.jpg",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_arrow_back_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_arrow_back_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_arrow_back_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_book.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_book_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_book_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_close_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_close_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_close_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_contacts.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_contacts_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_contacts_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_create_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_create_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_create_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_inbox.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_inbox_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_inbox_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_note_add_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_note_add_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_note_add_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_photo_camera_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_photo_camera_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_photo_camera_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_search_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_search_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_search_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_settings.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_settings_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_settings_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_today.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_today_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_today_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_work.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_work_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_work_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
/*
* 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 GraphKit 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 BlueViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
}
/// Prepares view.
private func prepareView() {
view.backgroundColor = MaterialColor.blue.base
}
}
......@@ -37,7 +37,7 @@ private struct Item {
var image: UIImage?
}
class MainViewController: UIViewController {
class FeedViewController: UIViewController {
/// A tableView used to display Bond entries.
private let tableView: UITableView = UITableView()
......@@ -53,10 +53,10 @@ class MainViewController: UIViewController {
/**
Handles the search button click, which opens the
SideNavigationBarViewController.
SideNavigationViewController.
*/
func handleSearchButton() {
sideNavigationBarViewController?.openRightView()
sideNavigationViewController?.openRightView()
}
/// Prepares view.
......@@ -90,7 +90,7 @@ class MainViewController: UIViewController {
}
/// TableViewDataSource methods.
extension MainViewController: UITableViewDataSource {
extension FeedViewController: UITableViewDataSource {
/// Determines the number of rows in the tableView.
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count;
......@@ -137,7 +137,7 @@ extension MainViewController: UITableViewDataSource {
}
/// UITableViewDelegate methods.
extension MainViewController: UITableViewDelegate {
extension FeedViewController: UITableViewDelegate {
/// Sets the tableView cell height.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 80
......
/*
* 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 GraphKit 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 GreenViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
}
/// Prepares view.
private func prepareView() {
view.backgroundColor = MaterialColor.green.base
}
}
/*
* 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 GraphKit 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
private struct Item {
var text: String
var detail: String
var image: UIImage?
}
class SearchListViewController: UIViewController {
/// A tableView used to display Bond entries.
private let tableView: UITableView = UITableView()
/// A list of all the Author Bond types.
private var items: Array<Item> = Array<Item>()
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareItems()
prepareTableView()
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
searchBarViewController?.searchBarView.textField.becomeFirstResponder()
}
/// Prepares view.
private func prepareView() {
view.backgroundColor = MaterialColor.white
}
/// Prepares the items Array.
private func prepareItems() {
items.append(Item(text: "Interview", detail: "The candidate will be arriving at 11:30, are you free?", image: UIImage(named: "Profile6")))
items.append(Item(text: "Book recommendation", detail: "I found the book title, Surely You’re Joking, Mr. Feynman!", image: UIImage(named: "Profile7")))
items.append(Item(text: "Oui oui", detail: "Do you have Paris recommendations? Have you ever been?", image: UIImage(named: "Profile8")))
}
/// Prepares the tableView.
private func prepareTableView() {
tableView.registerClass(MaterialTableViewCell.self, forCellReuseIdentifier: "MaterialTableViewCell")
tableView.dataSource = self
tableView.delegate = self
// Use MaterialLayout to easily align the tableView.
view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(view, child: tableView)
}
}
/// TableViewDataSource methods.
extension SearchListViewController: UITableViewDataSource {
/// Determines the number of rows in the tableView.
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count;
}
/// Returns the number of sections.
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
/// Prepares the cells within the tableView.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: MaterialTableViewCell = MaterialTableViewCell(style: .Subtitle, reuseIdentifier: "MaterialTableViewCell")
let item: Item = items[indexPath.row]
cell.selectionStyle = .None
cell.textLabel!.text = item.text
cell.textLabel!.font = RobotoFont.regular
cell.detailTextLabel!.text = item.detail
cell.detailTextLabel!.font = RobotoFont.regular
cell.detailTextLabel!.textColor = MaterialColor.grey.darken1
cell.imageView!.image = item.image?.resize(toWidth: 40)
cell.imageView!.layer.cornerRadius = 20
return cell
}
/// Prepares the header within the tableView.
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let header = UIView(frame: CGRectMake(0, 0, view.bounds.width, 48))
header.backgroundColor = MaterialColor.white
let label: UILabel = UILabel()
label.font = RobotoFont.medium
label.textColor = MaterialColor.grey.darken1
label.text = "Suggestions"
header.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(header, child: label, left: searchBarViewController!.searchBarView.contentInset.left + searchBarViewController!.searchBarView.spacing)
return header
}
}
/// UITableViewDelegate methods.
extension SearchListViewController: UITableViewDelegate {
/// Sets the tableView cell height.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 80
}
/// Sets the tableView header height.
func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 48
}
}
......@@ -59,18 +59,18 @@ class AppSearchBarViewController: SearchBarViewController {
/**
Handles the menu button click, which opens the
SideNavigationBarViewController.
SideNavigationViewController.
*/
func handleMenuButton() {
sideNavigationBarViewController?.openLeftView()
sideNavigationViewController?.openLeftView()
}
/**
Handles the more button click, which opens the
SideNavigationBarViewController.
SideNavigationViewController.
*/
func handleMoreButton() {
sideNavigationBarViewController?.openRightView()
sideNavigationViewController?.openRightView()
}
/// Handle the menuView touch event.
......@@ -200,7 +200,7 @@ class AppSearchBarViewController: SearchBarViewController {
/// Displays the menuBackdropLayer.
private func showMenuBackdropLayer() {
// Disable the side nav, so users can't swipe while viewing the menu.
sideNavigationBarViewController?.enabled = false
sideNavigationViewController?.enabled = false
// Position the menuBackdropLayer for the animation when opening.
MaterialAnimation.animationDisabled { [unowned self] in
......@@ -215,7 +215,7 @@ class AppSearchBarViewController: SearchBarViewController {
/// Hides the menuBackdropLayer.
private func hideMenuBackdropLayer() {
// Enable the side nav.
sideNavigationBarViewController?.enabled = true
sideNavigationViewController?.enabled = true
// Position the menuBackdropLayer for the animation when closing.
menuBackdropLayer.animate(MaterialAnimation.animationGroup([
......
......@@ -53,10 +53,10 @@ class MainViewController: UIViewController {
/**
Handles the search button click, which opens the
SideNavigationBarViewController.
SideNavigationViewController.
*/
func handleSearchButton() {
sideNavigationBarViewController?.openRightView()
sideNavigationViewController?.openRightView()
}
/// Prepares view.
......
......@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
961260741C78F2C700BF0079 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 961260731C78F2C700BF0079 /* Material.framework */; };
961260751C78F2C700BF0079 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 961260731C78F2C700BF0079 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9642FA1B1C1B50E700022BC6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9642FA1A1C1B50E700022BC6 /* AppDelegate.swift */; };
9642FA1D1C1B50E700022BC6 /* AppNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9642FA1C1C1B50E700022BC6 /* AppNavigationViewController.swift */; };
9642FA221C1B50E700022BC6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9642FA211C1B50E700022BC6 /* Assets.xcassets */; };
......@@ -24,6 +26,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
961260751C78F2C700BF0079 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -31,6 +34,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
961260731C78F2C700BF0079 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
9642FA171C1B50E700022BC6 /* SideNavigationViewController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SideNavigationViewController.app; sourceTree = BUILT_PRODUCTS_DIR; };
9642FA1A1C1B50E700022BC6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
9642FA1C1C1B50E700022BC6 /* AppNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppNavigationViewController.swift; sourceTree = "<group>"; };
......@@ -48,6 +52,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
961260741C78F2C700BF0079 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -57,6 +62,7 @@
9642FA0E1C1B50E700022BC6 = {
isa = PBXGroup;
children = (
961260731C78F2C700BF0079 /* Material.framework */,
9642FA191C1B50E700022BC6 /* SideNavigationViewController */,
9642FA181C1B50E700022BC6 /* Products */,
);
......
......@@ -39,7 +39,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = SideNavigationBarViewController(mainViewController: AppNavigationBarViewController(mainViewController: FeedViewController()), leftViewController: LeftViewController(), rightViewController: RightViewController())
window!.rootViewController = SideNavigationViewController(mainViewController: AppNavigationBarViewController(mainViewController: FeedViewController()), leftViewController: LeftViewController(), rightViewController: RightViewController())
window!.makeKeyAndVisible()
return true
}
......
......@@ -30,9 +30,9 @@
/*
The following is an example of setting a UITableView as the MainViewController
within a SideNavigationBarViewController. There is a NavigationBarView that is
within a SideNavigationViewController. There is a NavigationBarView that is
used for navigation, with a menu button that opens the
SideNavigationBarViewController.
SideNavigationViewController.
*/
import UIKit
......@@ -48,9 +48,6 @@ class AppNavigationBarViewController: NavigationBarViewController {
/// MenuView inset.
private let menuViewInset: CGFloat = 16
/// MenuView.
private let menuView: MenuView = MenuView()
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
......@@ -63,51 +60,51 @@ class AppNavigationBarViewController: NavigationBarViewController {
super.viewWillAppear(animated)
/*
Set the width of the SideNavigationBarViewController. Be mindful
Set the width of the SideNavigationViewController. Be mindful
of when setting this value. It is set in the viewWillAppear method,
because any earlier may cause a race condition when instantiating
the MainViewController and SideViewController.
*/
// sideNavigationBarViewController?.setLeftViewWidth(view.bounds.width - menuViewDiameter - 2 * menuViewInset, hidden: true, animated: false)
sideNavigationBarViewController?.delegate = self
// sideNavigationViewController?.setLeftViewWidth(view.bounds.width - menuViewDiameter - 2 * menuViewInset, hidden: true, animated: false)
sideNavigationViewController?.delegate = self
}
/**
Handles the menu button click, which opens the
SideNavigationBarViewController.
SideNavigationViewController.
*/
func handleMenuButton() {
sideNavigationBarViewController?.openLeftView()
sideNavigationViewController?.openLeftView()
}
/**
Handles the more button click, which opens the
SideNavigationBarViewController.
SideNavigationViewController.
*/
func handleMoreButton() {
sideNavigationBarViewController?.openRightView()
sideNavigationViewController?.openRightView()
}
/// Handle the menuView touch event.
func handleMenu() {
let image: UIImage?
if menuView.menu.opened {
if true == navigationBarViewController?.menuView?.menu.opened {
hideMenuBackdropLayer()
menuView.menu.close()
navigationBarViewController?.menuView?.menu.close()
image = UIImage(named: "ic_add_white")
} else {
showMenuBackdropLayer()
menuView.menu.open() { (v: UIView) in
navigationBarViewController?.menuView?.menu.open() { (v: UIView) in
(v as? MaterialButton)?.pulse()
}
image = UIImage(named: "ic_close_white")
}
// Add a nice rotation animation to the base button.
let first: MaterialButton? = menuView.menu.views?.first as? MaterialButton
let first: MaterialButton? = navigationBarViewController?.menuView?.menu.views?.first as? MaterialButton
first?.animate(MaterialAnimation.rotate(1))
first?.setImage(image, forState: .Normal)
first?.setImage(image, forState: .Highlighted)
......@@ -193,7 +190,7 @@ class AppNavigationBarViewController: NavigationBarViewController {
btn1.setImage(image, forState: .Normal)
btn1.setImage(image, forState: .Highlighted)
btn1.addTarget(self, action: "handleMenu", forControlEvents: .TouchUpInside)
menuView.addSubview(btn1)
navigationBarViewController?.menuView?.addSubview(btn1)
image = UIImage(named: "ic_create_white")
let btn2: FabButton = FabButton()
......@@ -201,7 +198,7 @@ class AppNavigationBarViewController: NavigationBarViewController {
btn2.setImage(image, forState: .Normal)
btn2.setImage(image, forState: .Highlighted)
btn2.addTarget(self, action: "openNote", forControlEvents: .TouchUpInside)
menuView.addSubview(btn2)
navigationBarViewController?.menuView?.addSubview(btn2)
image = UIImage(named: "ic_photo_camera_white")
......@@ -209,35 +206,34 @@ class AppNavigationBarViewController: NavigationBarViewController {
btn3.backgroundColor = MaterialColor.green.base
btn3.setImage(image, forState: .Normal)
btn3.setImage(image, forState: .Highlighted)
menuView.addSubview(btn3)
navigationBarViewController?.menuView?.addSubview(btn3)
image = UIImage(named: "ic_note_add_white")
let btn4: FabButton = FabButton()
btn4.backgroundColor = MaterialColor.amber.base
btn4.setImage(image, forState: .Normal)
btn4.setImage(image, forState: .Highlighted)
menuView.addSubview(btn4)
navigationBarViewController?.menuView?.addSubview(btn4)
// Initialize the menu and setup the configuration options.
menuView.menu.direction = .Up
menuView.menu.baseViewSize = CGSizeMake(menuViewDiameter, menuViewDiameter)
menuView.menu.views = [btn1, btn2, btn3, btn4]
menuView.zPosition = 3000
view.insertSubview(menuView, aboveSubview: navigationBarView)
menuView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.size(view, child: menuView, width: menuViewDiameter, height: menuViewDiameter)
MaterialLayout.alignFromBottomRight(view, child: menuView, bottom: menuViewInset, right: menuViewInset)
navigationBarViewController?.menuView?.menu.direction = .Up
navigationBarViewController?.menuView?.menu.baseViewSize = CGSizeMake(menuViewDiameter, menuViewDiameter)
navigationBarViewController?.menuView?.menu.views = [btn1, btn2, btn3, btn4]
navigationBarViewController?.menuView?.zPosition = 3000
navigationBarViewController?.menuView?.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.size(view, child: navigationBarViewController!.menuView!, width: menuViewDiameter, height: menuViewDiameter)
MaterialLayout.alignFromBottomRight(view, child: navigationBarViewController!.menuView!, bottom: menuViewInset, right: menuViewInset)
}
/// Displays the menuBackdropLayer.
private func showMenuBackdropLayer() {
// Disable the side nav, so users can't swipe while viewing the menu.
sideNavigationBarViewController?.enabled = false
sideNavigationViewController?.enabled = false
// Position the menuBackdropLayer for the animation when opening.
MaterialAnimation.animationDisabled { [unowned self] in
self.menuBackdropLayer.frame = self.menuView.frame
self.menuBackdropLayer.frame = self.navigationBarViewController!.menuView!.frame
self.menuBackdropLayer.shape = .Circle
self.menuBackdropLayer.hidden = false
}
......@@ -248,12 +244,12 @@ class AppNavigationBarViewController: NavigationBarViewController {
/// Hides the menuBackdropLayer.
private func hideMenuBackdropLayer() {
// Enable the side nav.
sideNavigationBarViewController?.enabled = true
sideNavigationViewController?.enabled = true
// Position the menuBackdropLayer for the animation when closing.
menuBackdropLayer.animate(MaterialAnimation.animationGroup([
MaterialAnimation.scale(1),
MaterialAnimation.position(menuView.center)
MaterialAnimation.position(navigationBarViewController!.menuView!.center)
], duration: 0.25))
MaterialAnimation.delay(0.25) { [weak self] in
......@@ -262,69 +258,69 @@ class AppNavigationBarViewController: NavigationBarViewController {
}
}
/// SideNavigationBarViewControllerDelegate methods.
extension AppNavigationBarViewController: SideNavigationBarViewControllerDelegate {
/// SideNavigationViewControllerDelegate methods.
extension AppNavigationBarViewController: SideNavigationViewControllerDelegate {
/**
An optional delegation method that is fired before the
SideNavigationBarViewController opens.
SideNavigationViewController opens.
*/
func sideNavigationViewWillOpen(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition) {
func sideNavigationViewWillOpen(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition) {
print("Will open", .Left == position ? "Left" : "Right", "view.")
}
/**
An optional delegation method that is fired after the
SideNavigationBarViewController opened.
SideNavigationViewController opened.
*/
func sideNavigationViewDidOpen(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition) {
func sideNavigationViewDidOpen(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition) {
print("Did open", .Left == position ? "Left" : "Right", "view.")
}
/**
An optional delegation method that is fired before the
SideNavigationBarViewController closes.
SideNavigationViewController closes.
*/
func sideNavigationViewWillClose(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition) {
func sideNavigationViewWillClose(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition) {
print("Will close", .Left == position ? "Left" : "Right", "view.")
}
/**
An optional delegation method that is fired after the
SideNavigationBarViewController closed.
SideNavigationViewController closed.
*/
func sideNavigationViewDidClose(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition) {
func sideNavigationViewDidClose(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition) {
print("Did close", .Left == position ? "Left" : "Right", "view.")
}
/**
An optional delegation method that is fired when the
SideNavigationBarViewController pan gesture begins.
SideNavigationViewController pan gesture begins.
*/
func sideNavigationViewPanDidBegin(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition) {
func sideNavigationViewPanDidBegin(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition) {
print("Pan did begin for", .Left == position ? "Left" : "Right", "view.")
}
/**
An optional delegation method that is fired when the
SideNavigationBarViewController pan gesture changes position.
SideNavigationViewController pan gesture changes position.
*/
func sideNavigationViewPanDidChange(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition) {
func sideNavigationViewPanDidChange(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition) {
print("Pan did change for", .Left == position ? "Left" : "Right", "view.")
}
/**
An optional delegation method that is fired when the
SideNavigationBarViewController pan gesture ends.
SideNavigationViewController pan gesture ends.
*/
func sideNavigationViewPanDidEnd(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition) {
func sideNavigationViewPanDidEnd(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition) {
print("Pan did end for", .Left == position ? "Left" : "Right", "view.")
}
/**
An optional delegation method that is fired when the
SideNavigationBarViewController tap gesture executes.
SideNavigationViewController tap gesture executes.
*/
func sideNavigationViewDidTap(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition) {
func sideNavigationViewDidTap(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition) {
print("Did Tap for", .Left == position ? "Left" : "Right", "view.")
}
}
......@@ -53,10 +53,10 @@ class FeedViewController: UIViewController {
/**
Handles the search button click, which opens the
SideNavigationBarViewController.
SideNavigationViewController.
*/
func handleSearchButton() {
sideNavigationBarViewController?.openRightView()
sideNavigationViewController?.openRightView()
}
/// Prepares view.
......
......@@ -30,7 +30,7 @@
/*
The following is an example of setting a UITableView as the LeftViewController
within a SideNavigationBarViewController.
within a SideNavigationViewController.
*/
import UIKit
......
......@@ -53,10 +53,10 @@ class NoteViewController: UIViewController {
/**
Handles the search button click, which opens the
SideNavigationBarViewController.
SideNavigationViewController.
*/
func handleSearchButton() {
sideNavigationBarViewController?.openRightView()
sideNavigationViewController?.openRightView()
}
/// Prepares view.
......
......@@ -30,7 +30,7 @@
/*
The following is an example of setting a UITableView as the RightViewController
within a SideNavigationBarViewController.
within a SideNavigationViewController.
*/
import UIKit
......
......@@ -43,9 +43,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let mainViewController = storyboard.instantiateViewControllerWithIdentifier("MainViewController") as! MainViewController
let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideViewController") as! SideViewController
// Configure the window with the SideNavigationBarViewController as the root view controller
// Configure the window with the SideNavigationViewController as the root view controller
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = SideNavigationBarViewController(mainViewController: mainViewController, leftViewController: sideViewController)
window?.rootViewController = SideNavigationViewController(mainViewController: mainViewController, leftViewController: sideViewController)
window?.makeKeyAndVisible()
return true
}
......
......@@ -36,7 +36,7 @@ class MainViewController: UIViewController {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// Toggle SideNavigationBarViewController.
// Toggle SideNavigationViewController.
let img: UIImage? = UIImage(named: "ic_create_white")
let fabButton: FabButton = FabButton()
fabButton.setImage(img, forState: .Normal)
......@@ -51,7 +51,7 @@ class MainViewController: UIViewController {
// FabButton handler.
func handleFabButton() {
sideNavigationBarViewController?.toggleLeftView()
sideNavigationViewController?.toggleLeftView()
}
}
......@@ -29,6 +29,7 @@
960B23501C38490D00E96216 /* Text.swift in Headers */ = {isa = PBXBuildFile; fileRef = 960B23431C38480E00E96216 /* Text.swift */; settings = {ATTRIBUTES = (Public, ); }; };
960B23511C38490D00E96216 /* TextStorage.swift in Headers */ = {isa = PBXBuildFile; fileRef = 960B23441C38480E00E96216 /* TextStorage.swift */; settings = {ATTRIBUTES = (Public, ); }; };
960B23521C38490D00E96216 /* TextView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 960B23451C38480E00E96216 /* TextView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9626C2DE1C795017007CA8E0 /* MenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9626C2DD1C795017007CA8E0 /* MenuViewController.swift */; };
963832421B88DFD80015F710 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963832361B88DFD80015F710 /* Material.framework */; };
96442ADB1C28EEFA00C3C574 /* TextField.swift in Headers */ = {isa = PBXBuildFile; fileRef = 966F57B71C226D75009185B7 /* TextField.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96442ADE1C28EF3700C3C574 /* MaterialTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96442ADD1C28EF3700C3C574 /* MaterialTableViewCell.swift */; };
......@@ -138,6 +139,7 @@
960B23431C38480E00E96216 /* Text.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Text.swift; sourceTree = "<group>"; };
960B23441C38480E00E96216 /* TextStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextStorage.swift; sourceTree = "<group>"; };
960B23451C38480E00E96216 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
9626C2DD1C795017007CA8E0 /* MenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuViewController.swift; sourceTree = "<group>"; };
963832361B88DFD80015F710 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Material.framework; sourceTree = BUILT_PRODUCTS_DIR; };
963832411B88DFD80015F710 /* Material.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Material.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
963832591B88E31A0015F710 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
......@@ -211,6 +213,32 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9626C2DA1C794FA5007CA8E0 /* NavigationBar */ = {
isa = PBXGroup;
children = (
96D88C151C1328D800B91418 /* NavigationBarView.swift */,
96A71F2F1C72E41100C0C4AE /* NavigationBarViewController.swift */,
);
name = NavigationBar;
sourceTree = "<group>";
};
9626C2DB1C794FBB007CA8E0 /* SearchBar */ = {
isa = PBXGroup;
children = (
96A71EF51C71127100C0C4AE /* SearchBarView.swift */,
960036141C77E1B600EBA579 /* SearchBarViewController.swift */,
);
name = SearchBar;
sourceTree = "<group>";
};
9626C2DC1C794FE5007CA8E0 /* SideNavigation */ = {
isa = PBXGroup;
children = (
96D88C1D1C1328D800B91418 /* SideNavigationViewController.swift */,
);
name = SideNavigation;
sourceTree = "<group>";
};
9638322C1B88DFD80015F710 = {
isa = PBXGroup;
children = (
......@@ -269,6 +297,7 @@
children = (
65FDC2EA1C66858A00103AC2 /* Menu.swift */,
96A71E901C6FBC2200C0C4AE /* MenuView.swift */,
9626C2DD1C795017007CA8E0 /* MenuViewController.swift */,
);
name = Menu;
sourceTree = "<group>";
......@@ -281,14 +310,6 @@
name = Switch;
sourceTree = "<group>";
};
96A71FB51C764F3D00C0C4AE /* Control */ = {
isa = PBXGroup;
children = (
96A71FB01C7649F800C0C4AE /* ControlView.swift */,
);
name = Control;
sourceTree = "<group>";
};
96D88BF41C1328D800B91418 /* Sources */ = {
isa = PBXGroup;
children = (
......@@ -312,8 +333,10 @@
965C58BD1C6B8D3300CFB4E1 /* Grid */,
96A71E921C6FBC2900C0C4AE /* Menu */,
96A71EC51C6FFEF300C0C4AE /* Switch */,
96A71FB51C764F3D00C0C4AE /* Control */,
96D88C541C132A7700B91418 /* Navigation */,
96D88C541C132A7700B91418 /* StatusBar */,
9626C2DB1C794FBB007CA8E0 /* SearchBar */,
9626C2DA1C794FA5007CA8E0 /* NavigationBar */,
9626C2DC1C794FE5007CA8E0 /* SideNavigation */,
);
path = Sources;
sourceTree = "<group>";
......@@ -444,17 +467,13 @@
name = View;
sourceTree = "<group>";
};
96D88C541C132A7700B91418 /* Navigation */ = {
96D88C541C132A7700B91418 /* StatusBar */ = {
isa = PBXGroup;
children = (
96A71FB01C7649F800C0C4AE /* ControlView.swift */,
96A71FB21C764E3200C0C4AE /* StatusBarView.swift */,
96A71EF51C71127100C0C4AE /* SearchBarView.swift */,
960036141C77E1B600EBA579 /* SearchBarViewController.swift */,
96D88C151C1328D800B91418 /* NavigationBarView.swift */,
96A71F2F1C72E41100C0C4AE /* NavigationBarViewController.swift */,
96D88C1D1C1328D800B91418 /* SideNavigationViewController.swift */,
);
name = Navigation;
name = StatusBar;
sourceTree = "<group>";
};
96DB1C751C14C11B00825BE6 /* Color */ = {
......@@ -674,6 +693,7 @@
96D88C461C1328D800B91418 /* SideNavigationViewController.swift in Sources */,
96D88C381C1328D800B91418 /* MaterialShape.swift in Sources */,
960B23331C383EAA00E96216 /* Material+UIImage+Size.swift in Sources */,
9626C2DE1C795017007CA8E0 /* MenuViewController.swift in Sources */,
96A71FB61C7651AA00C0C4AE /* ControlView.swift in Sources */,
96A71F451C74ABCB00C0C4AE /* MaterialBorder.swift in Sources */,
96A71E911C6FBC2200C0C4AE /* MenuView.swift in Sources */,
......
......@@ -175,10 +175,10 @@ public class Menu {
view.alpha = 1
view.frame.origin.y = base!.frame.origin.y - CGFloat(i) * self.itemViewSize.height - CGFloat(i) * self.spacing
animations?(view)
}, completion: { [unowned self] _ in
}) { [unowned self] _ in
completion?(view)
self.enable(view)
})
}
}
opened = true
}
......@@ -208,11 +208,11 @@ public class Menu {
view.alpha = 0
view.frame.origin.y = self.origin.y
animations?(view)
}, completion: { [unowned self] _ in
}) { [unowned self] _ in
view.hidden = true
completion?(view)
self.enable(view)
})
}
}
opened = false
}
......@@ -249,10 +249,10 @@ public class Menu {
view.alpha = 1
view.frame.origin.y = base!.frame.origin.y + h + CGFloat(i - 1) * self.itemViewSize.height + CGFloat(i) * self.spacing
animations?(view)
}, completion: { [unowned self] _ in
}) { [unowned self] _ in
completion?(view)
self.enable(view)
})
}
}
opened = true
}
......@@ -283,11 +283,11 @@ public class Menu {
view.alpha = 0
view.frame.origin.y = self.origin.y + h
animations?(view)
}, completion: { [unowned self] _ in
}) { [unowned self] _ in
view.hidden = true
completion?(view)
self.enable(view)
})
}
}
opened = false
}
......@@ -323,10 +323,10 @@ public class Menu {
view.alpha = 1
view.frame.origin.x = base!.frame.origin.x - CGFloat(i) * self.itemViewSize.width - CGFloat(i) * self.spacing
animations?(view)
}, completion: { [unowned self] _ in
}) { [unowned self] _ in
completion?(view)
self.enable(view)
})
}
}
opened = true
}
......@@ -355,11 +355,11 @@ public class Menu {
view.alpha = 0
view.frame.origin.x = self.origin.x
animations?(view)
}, completion: { [unowned self] _ in
}) { [unowned self] _ in
view.hidden = true
completion?(view)
self.enable(view)
})
}
}
opened = false
}
......@@ -395,10 +395,10 @@ public class Menu {
view.alpha = 1
view.frame.origin.x = base!.frame.origin.x + h + CGFloat(i - 1) * self.itemViewSize.width + CGFloat(i) * self.spacing
animations?(view)
}, completion: { [unowned self] _ in
}) { [unowned self] _ in
completion?(view)
self.enable(view)
})
}
}
opened = true
}
......@@ -429,11 +429,11 @@ public class Menu {
view.alpha = 0
view.frame.origin.x = self.origin.x + w
animations?(view)
}, completion: { [unowned self] _ in
}) { [unowned self] _ in
view.hidden = true
completion?(view)
self.enable(view)
})
}
}
opened = false
}
......
/*
* 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 Material 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
public extension UIViewController {
/**
A convenience property that provides access to the MenuViewController.
This is the recommended method of accessing the MenuViewController
through child UIViewControllers.
*/
public var menuViewController: MenuViewController? {
var viewController: UIViewController? = self
while nil != viewController {
if viewController is MenuViewController {
return viewController as? MenuViewController
}
viewController = viewController?.parentViewController
}
return nil
}
}
public class MenuViewController: UIViewController {
/// Reference to the MenuView.
public private(set) lazy var menuView: MenuView = MenuView()
/**
A Boolean property used to enable and disable interactivity
with the mainViewController.
*/
public var userInteractionEnabled: Bool {
get {
return mainViewController.view.userInteractionEnabled
}
set(value) {
mainViewController.view.userInteractionEnabled = value
}
}
/**
A UIViewController property that references the active
main UIViewController. To swap the mainViewController, it
is recommended to use the transitionFromMainViewController
helper method.
*/
public private(set) var mainViewController: UIViewController!
/**
An initializer for the MenuViewController.
- Parameter mainViewController: The main UIViewController.
*/
public convenience init(mainViewController: UIViewController) {
self.init()
self.mainViewController = mainViewController
prepareView()
}
public override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
layoutSubviews()
}
/**
A method to swap mainViewController objects.
- Parameter toViewController: The UIViewController to swap
with the active mainViewController.
- Parameter duration: A NSTimeInterval that sets the
animation duration of the transition.
- Parameter options: UIViewAnimationOptions thst are used
when animating the transition from the active mainViewController
to the toViewController.
- Parameter animations: An animation block that is executed during
the transition from the active mainViewController
to the toViewController.
- Parameter completion: A completion block that is execited after
the transition animation from the active mainViewController
to the toViewController has completed.
*/
public func transitionFromMainViewController(toViewController: UIViewController, duration: NSTimeInterval = 0.5, options: UIViewAnimationOptions = [], animations: (() -> Void)? = nil, completion: ((Bool) -> Void)? = nil) {
mainViewController.willMoveToParentViewController(nil)
addChildViewController(toViewController)
toViewController.view.frame = mainViewController.view.frame
transitionFromViewController(mainViewController,
toViewController: toViewController,
duration: duration,
options: options,
animations: animations,
completion: { [unowned self] (result: Bool) in
toViewController.didMoveToParentViewController(self)
self.mainViewController.removeFromParentViewController()
self.mainViewController = toViewController
self.view.sendSubviewToBack(self.mainViewController.view)
completion?(result)
})
}
/// A method that generally prepares the MenuViewController.
private func prepareView() {
prepareMenuView()
prepareMainViewController()
}
/// Prepares the MenuView.
private func prepareMenuView() {
menuView.zPosition = 1000
view.addSubview(menuView)
}
/// A method that prepares the mainViewController.
private func prepareMainViewController() {
prepareViewControllerWithinContainer(mainViewController, container: view)
}
/**
A method that adds the passed in controller as a child of
the MenuViewController within the passed in
container view.
- Parameter viewController: A UIViewController to add as a child.
- Parameter container: A UIView that is the parent of the
passed in controller view within the view hierarchy.
*/
private func prepareViewControllerWithinContainer(viewController: UIViewController?, container: UIView) {
if let v: UIViewController = viewController {
addChildViewController(v)
container.insertSubview(v.view, atIndex: 0)
v.didMoveToParentViewController(self)
}
}
/// Layout subviews.
private func layoutSubviews() {
mainViewController.view.frame = view.bounds
}
}
......@@ -49,8 +49,59 @@ public extension UIViewController {
}
public class NavigationBarViewController: UIViewController {
/// Reference to the NavigationBarView.
public private(set) lazy var navigationBarView: NavigationBarView = NavigationBarView()
/// Internal reference to the floatingViewController.
private var internalFloatingViewController: UIViewController?
/// A floating UIViewController.
public var floatingViewController: UIViewController? {
get {
return internalFloatingViewController
}
set(value) {
if let v: UIViewController = value {
/**
Disable the sideNavigationViewController from opening while in
noteViewController.
*/
sideNavigationViewController?.enabled = false
// Add the noteViewController! to the view.
addChildViewController(v)
v.view.frame = view.bounds
v.view.center.y = 2 * view.bounds.height
v.view.hidden = true
view.insertSubview(v.view, aboveSubview: navigationBarView)
v.view.layer.zPosition = 1500
v.didMoveToParentViewController(self)
// Animate the noteButton out and the noteViewController! in.
v.view.hidden = false
internalFloatingViewController = v
UIView.animateWithDuration(0.5,
animations: { [unowned self] in
v.view.center.y = self.view.bounds.height / 2
})
} else if let v: UIViewController = internalFloatingViewController {
sideNavigationViewController?.enabled = true
internalFloatingViewController = nil
UIView.animateWithDuration(0.5,
animations: { [unowned self] in
v.view.center.y = 2 * self.view.bounds.height
}) { _ in
v.willMoveToParentViewController(nil)
v.view.removeFromSuperview()
v.removeFromParentViewController()
}
}
}
}
/**
A Boolean property used to enable and disable interactivity
with the mainViewController.
......@@ -103,10 +154,10 @@ public class NavigationBarViewController: UIViewController {
the transition animation from the active mainViewController
to the toViewController has completed.
*/
public func transitionFromMainViewController(toViewController: UIViewController, duration: NSTimeInterval = 0.5, options: UIViewAnimationOptions = [], animations: (() -> Void)?, completion: ((Bool) -> Void)?) {
public func transitionFromMainViewController(toViewController: UIViewController, duration: NSTimeInterval = 0.5, options: UIViewAnimationOptions = [], animations: (() -> Void)? = nil, completion: ((Bool) -> Void)? = nil) {
mainViewController.willMoveToParentViewController(nil)
addChildViewController(toViewController)
toViewController.view.frame = view.bounds
toViewController.view.frame = mainViewController.view.frame
transitionFromViewController(mainViewController,
toViewController: toViewController,
duration: duration,
......@@ -116,6 +167,7 @@ public class NavigationBarViewController: UIViewController {
toViewController.didMoveToParentViewController(self)
self.mainViewController.removeFromParentViewController()
self.mainViewController = toViewController
self.view.sendSubviewToBack(self.mainViewController.view)
completion?(result)
})
}
......@@ -129,6 +181,7 @@ public class NavigationBarViewController: UIViewController {
/// Prepares the NavigationBarView.
private func prepareNavigationBarView() {
navigationBarView.delegate = self
navigationBarView.zPosition = 1000
view.addSubview(navigationBarView)
}
......
......@@ -65,10 +65,10 @@ public class SearchBarView : StatusBarView {
}
/// Placeholder textColor.
public var placeholderTextColor: UIColor? {
public var placeholderTextColor: UIColor = MaterialColor.black {
didSet {
if let v: String = textField.placeholder {
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: MaterialColor.white])
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderTextColor])
}
}
}
......@@ -78,7 +78,7 @@ public class SearchBarView : StatusBarView {
didSet {
textField.placeholder = placeholder
if let v: String = textField.placeholder {
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: MaterialColor.white])
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderTextColor])
}
}
}
......
......@@ -49,6 +49,7 @@ public extension UIViewController {
}
public class SearchBarViewController: UIViewController {
/// Reference to the SearchBarView.
public private(set) lazy var searchBarView: SearchBarView = SearchBarView()
/**
......@@ -103,10 +104,10 @@ public class SearchBarViewController: UIViewController {
the transition animation from the active mainViewController
to the toViewController has completed.
*/
public func transitionFromMainViewController(toViewController: UIViewController, duration: NSTimeInterval = 0.5, options: UIViewAnimationOptions = [], animations: (() -> Void)?, completion: ((Bool) -> Void)?) {
public func transitionFromMainViewController(toViewController: UIViewController, duration: NSTimeInterval = 0.5, options: UIViewAnimationOptions = [], animations: (() -> Void)? = nil, completion: ((Bool) -> Void)? = nil) {
mainViewController.willMoveToParentViewController(nil)
addChildViewController(toViewController)
toViewController.view.frame = view.bounds
toViewController.view.frame = mainViewController.view.frame
transitionFromViewController(mainViewController,
toViewController: toViewController,
duration: duration,
......@@ -116,6 +117,7 @@ public class SearchBarViewController: UIViewController {
toViewController.didMoveToParentViewController(self)
self.mainViewController.removeFromParentViewController()
self.mainViewController = toViewController
self.view.sendSubviewToBack(self.mainViewController.view)
completion?(result)
})
}
......@@ -129,6 +131,7 @@ public class SearchBarViewController: UIViewController {
/// Prepares the SearchBarView.
private func prepareSearchBarView() {
searchBarView.delegate = self
searchBarView.zPosition = 1000
view.addSubview(searchBarView)
}
......
......@@ -38,15 +38,15 @@ public enum SideNavigationPosition : NSInteger {
public extension UIViewController {
/**
A convenience property that provides access to the SideNavigationBarViewController.
This is the recommended method of accessing the SideNavigationBarViewController
A convenience property that provides access to the SideNavigationViewController.
This is the recommended method of accessing the SideNavigationViewController
through child UIViewControllers.
*/
public var sideNavigationBarViewController: SideNavigationBarViewController? {
public var sideNavigationViewController: SideNavigationViewController? {
var viewController: UIViewController? = self
while nil != viewController {
if viewController is SideNavigationBarViewController {
return viewController as? SideNavigationBarViewController
if viewController is SideNavigationViewController {
return viewController as? SideNavigationViewController
}
viewController = viewController?.parentViewController
}
......@@ -54,59 +54,59 @@ public extension UIViewController {
}
}
@objc(SideNavigationBarViewControllerDelegate)
public protocol SideNavigationBarViewControllerDelegate {
@objc(SideNavigationViewControllerDelegate)
public protocol SideNavigationViewControllerDelegate {
/**
An optional delegation method that is fired before the
SideNavigationBarViewController opens.
SideNavigationViewController opens.
*/
optional func sideNavigationViewWillOpen(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition)
optional func sideNavigationViewWillOpen(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition)
/**
An optional delegation method that is fired after the
SideNavigationBarViewController opened.
SideNavigationViewController opened.
*/
optional func sideNavigationViewDidOpen(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition)
optional func sideNavigationViewDidOpen(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition)
/**
An optional delegation method that is fired before the
SideNavigationBarViewController closes.
SideNavigationViewController closes.
*/
optional func sideNavigationViewWillClose(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition)
optional func sideNavigationViewWillClose(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition)
/**
An optional delegation method that is fired after the
SideNavigationBarViewController closed.
SideNavigationViewController closed.
*/
optional func sideNavigationViewDidClose(sideNavigationBarViewController: SideNavigationBarViewController, position: SideNavigationPosition)
optional func sideNavigationViewDidClose(sideNavigationViewController: SideNavigationViewController, position: SideNavigationPosition)
/**
An optional delegation method that is fired when the
SideNavigationBarViewController pan gesture begins.
SideNavigationViewController pan gesture begins.
*/
optional func sideNavigationViewPanDidBegin(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition)
optional func sideNavigationViewPanDidBegin(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition)
/**
An optional delegation method that is fired when the
SideNavigationBarViewController pan gesture changes position.
SideNavigationViewController pan gesture changes position.
*/
optional func sideNavigationViewPanDidChange(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition)
optional func sideNavigationViewPanDidChange(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition)
/**
An optional delegation method that is fired when the
SideNavigationBarViewController pan gesture ends.
SideNavigationViewController pan gesture ends.
*/
optional func sideNavigationViewPanDidEnd(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition)
optional func sideNavigationViewPanDidEnd(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition)
/**
An optional delegation method that is fired when the
SideNavigationBarViewController tap gesture executes.
SideNavigationViewController tap gesture executes.
*/
optional func sideNavigationViewDidTap(sideNavigationBarViewController: SideNavigationBarViewController, point: CGPoint, position: SideNavigationPosition)
optional func sideNavigationViewDidTap(sideNavigationViewController: SideNavigationViewController, point: CGPoint, position: SideNavigationPosition)
}
@objc(SideNavigationBarViewController)
public class SideNavigationBarViewController: UIViewController, UIGestureRecognizerDelegate {
@objc(SideNavigationViewController)
public class SideNavigationViewController: UIViewController, UIGestureRecognizerDelegate {
/**
A CGFloat property that is used internally to track
the original (x) position of the container view when panning.
......@@ -135,7 +135,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
/**
A CGFloat property that accesses the leftView threshold of
the SideNavigationBarViewController. When the panning gesture has
the SideNavigationViewController. When the panning gesture has
ended, if the position is beyond the threshold,
the leftView is opened, if it is below the threshold, the
leftView is closed. The leftViewThreshold is always at half
......@@ -145,7 +145,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
/**
A CGFloat property that accesses the rightView threshold of
the SideNavigationBarViewController. When the panning gesture has
the SideNavigationViewController. When the panning gesture has
ended, if the position is beyond the threshold,
the rightView is closed, if it is below the threshold, the
rightView is opened. The rightViewThreshold is always at half
......@@ -154,10 +154,10 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
public private(set) var rightViewThreshold: CGFloat = 0
/**
A SideNavigationBarViewControllerDelegate property used to bind
A SideNavigationViewControllerDelegate property used to bind
the delegation object.
*/
public weak var delegate: SideNavigationBarViewControllerDelegate?
public weak var delegate: SideNavigationViewControllerDelegate?
/**
A Boolean property used to enable and disable interactivity
......@@ -318,7 +318,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
public private(set) var rightViewWidth: CGFloat = 240
/**
An initializer for the SideNavigationBarViewController.
An initializer for the SideNavigationViewController.
- Parameter mainViewController: The main UIViewController.
- Parameter leftViewController: An Optional left UIViewController.
- Parameter rightViewController: An Optional right UIViewController.
......@@ -358,10 +358,10 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
the transition animation from the active mainViewController
to the toViewController has completed.
*/
public func transitionFromMainViewController(toViewController: UIViewController, duration: NSTimeInterval = 0.5, options: UIViewAnimationOptions = [], animations: (() -> Void)?, completion: ((Bool) -> Void)?) {
public func transitionFromMainViewController(toViewController: UIViewController, duration: NSTimeInterval = 0.5, options: UIViewAnimationOptions = [], animations: (() -> Void)? = nil, completion: ((Bool) -> Void)? = nil) {
mainViewController.willMoveToParentViewController(nil)
addChildViewController(toViewController)
toViewController.view.frame = view.bounds
toViewController.view.frame = mainViewController.view.frame
transitionFromViewController(mainViewController,
toViewController: toViewController,
duration: duration,
......@@ -371,6 +371,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
toViewController.didMoveToParentViewController(self)
self.mainViewController.removeFromParentViewController()
self.mainViewController = toViewController
self.view.sendSubviewToBack(self.mainViewController.view)
self.userInteractionEnabled = !self.opened
completion?(result)
})
......@@ -631,7 +632,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
/**
A method that is fired when the pan gesture is recognized
for the SideNavigationBarViewController.
for the SideNavigationViewController.
- Parameter recognizer: A UIPanGestureRecognizer that is
passed to the handler when recognized.
*/
......@@ -712,7 +713,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
/**
A method that is fired when the tap gesture is recognized
for the SideNavigationBarViewController.
for the SideNavigationViewController.
- Parameter recognizer: A UITapGestureRecognizer that is
passed to the handler when recognized.
*/
......@@ -735,7 +736,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
}
}
/// A method that generally prepares the SideNavigationBarViewController.
/// A method that generally prepares the SideNavigationViewController.
private func prepareView() {
prepareBackdropLayer()
prepareMainViewController()
......@@ -810,7 +811,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
/**
A method that adds the passed in controller as a child of
the SideNavigationBarViewController within the passed in
the SideNavigationViewController within the passed in
container view.
- Parameter viewController: A UIViewController to add as a child.
- Parameter container: A UIView that is the parent of the
......@@ -826,7 +827,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
/**
A method that prepares the gestures used within the
SideNavigationBarViewController.
SideNavigationViewController.
- Parameter panSelector: A Selector that is fired when the
pan gesture is recognized.
- Parameter tapSelector: A Selector that is fired when the
......@@ -883,7 +884,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
/**
A method that determines whether the passed point is
contained within the bounds of the leftViewThreshold
and height of the SideNavigationBarViewController view frame
and height of the SideNavigationViewController view frame
property.
- Parameter point: A CGPoint to test against.
- Returns: A Boolean of the result, true if yes, false
......@@ -896,7 +897,7 @@ public class SideNavigationBarViewController: UIViewController, UIGestureRecogni
/**
A method that determines whether the passed point is
contained within the bounds of the rightViewThreshold
and height of the SideNavigationBarViewController view frame
and height of the SideNavigationViewController view frame
property.
- Parameter point: A CGPoint to test against.
- Returns: A Boolean of the result, true if yes, 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