Commit 8d47964e by Daniel Dahan

updated selectors for swift 2.3

parent 8121a69b
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
96162C691CA7191800E3A235 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96162C681CA7191800E3A235 /* Material.framework */; };
96162C6A1CA7191800E3A235 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96162C681CA7191800E3A235 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96162C6C1CA71C8700E3A235 /* VideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C6B1CA71C8700E3A235 /* VideoViewController.swift */; };
96162C6E1CA7274E00E3A235 /* PhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */; };
9663F9321C7A744600AF0965 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9311C7A744600AF0965 /* AppDelegate.swift */; }; 9663F9321C7A744600AF0965 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9311C7A744600AF0965 /* AppDelegate.swift */; };
9663F9341C7A744600AF0965 /* RecommendationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9331C7A744600AF0965 /* RecommendationViewController.swift */; }; 9663F9341C7A744600AF0965 /* RecommendationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9331C7A744600AF0965 /* RecommendationViewController.swift */; };
9663F9391C7A744600AF0965 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9663F9381C7A744600AF0965 /* Assets.xcassets */; }; 9663F9391C7A744600AF0965 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9663F9381C7A744600AF0965 /* Assets.xcassets */; };
...@@ -27,6 +31,7 @@ ...@@ -27,6 +31,7 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
96162C6A1CA7191800E3A235 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -34,6 +39,9 @@ ...@@ -34,6 +39,9 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
96162C681CA7191800E3A235 /* 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>"; };
96162C6B1CA71C8700E3A235 /* VideoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoViewController.swift; sourceTree = "<group>"; };
96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoViewController.swift; sourceTree = "<group>"; };
9663F92E1C7A744600AF0965 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9663F92E1C7A744600AF0965 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };
9663F9311C7A744600AF0965 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 9663F9311C7A744600AF0965 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
9663F9331C7A744600AF0965 /* RecommendationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendationViewController.swift; sourceTree = "<group>"; }; 9663F9331C7A744600AF0965 /* RecommendationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendationViewController.swift; sourceTree = "<group>"; };
...@@ -54,6 +62,7 @@ ...@@ -54,6 +62,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96162C691CA7191800E3A235 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -63,6 +72,7 @@ ...@@ -63,6 +72,7 @@
9663F9251C7A744500AF0965 = { 9663F9251C7A744500AF0965 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96162C681CA7191800E3A235 /* Material.framework */,
9663F9301C7A744600AF0965 /* App */, 9663F9301C7A744600AF0965 /* App */,
9663F92F1C7A744600AF0965 /* Products */, 9663F92F1C7A744600AF0965 /* Products */,
); );
...@@ -88,6 +98,8 @@ ...@@ -88,6 +98,8 @@
96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */, 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */,
9663F9331C7A744600AF0965 /* RecommendationViewController.swift */, 9663F9331C7A744600AF0965 /* RecommendationViewController.swift */,
9663F9511C7A751D00AF0965 /* ItemViewController.swift */, 9663F9511C7A751D00AF0965 /* ItemViewController.swift */,
96162C6B1CA71C8700E3A235 /* VideoViewController.swift */,
96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */,
9663F9381C7A744600AF0965 /* Assets.xcassets */, 9663F9381C7A744600AF0965 /* Assets.xcassets */,
9663F93A1C7A744600AF0965 /* LaunchScreen.storyboard */, 9663F93A1C7A744600AF0965 /* LaunchScreen.storyboard */,
9663F93D1C7A744600AF0965 /* Info.plist */, 9663F93D1C7A744600AF0965 /* Info.plist */,
...@@ -174,7 +186,9 @@ ...@@ -174,7 +186,9 @@
9663F94C1C7A74C700AF0965 /* AppMenuViewController.swift in Sources */, 9663F94C1C7A74C700AF0965 /* AppMenuViewController.swift in Sources */,
9663F9321C7A744600AF0965 /* AppDelegate.swift in Sources */, 9663F9321C7A744600AF0965 /* AppDelegate.swift in Sources */,
9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */, 9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */,
96162C6C1CA71C8700E3A235 /* VideoViewController.swift in Sources */,
9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */, 9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */,
96162C6E1CA7274E00E3A235 /* PhotoViewController.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
...@@ -37,9 +37,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -37,9 +37,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow? var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let bottomNavigationController: BottomNavigationController = BottomNavigationController()
bottomNavigationController.viewControllers = [AppMenuViewController(mainViewController: AppNavigationController(rootViewController: RecipesViewController())), VideoViewController(), PhotoViewController()]
bottomNavigationController.selectedIndex = 0
bottomNavigationController.tabBar.tintColor = MaterialColor.lightBlue.base
bottomNavigationController.tabBar.backgroundColor = MaterialColor.grey.darken4
// Override point for customization after application launch. // Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds) window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = SideNavigationController(mainViewController: AppMenuViewController(mainViewController: AppNavigationController(rootViewController: RecipesViewController())), leftViewController: AppLeftViewController(), rightViewController: AppRightViewController()) window!.rootViewController = SideNavigationController(mainViewController: bottomNavigationController, leftViewController: AppLeftViewController(), rightViewController: AppRightViewController())
window!.makeKeyAndVisible() window!.makeKeyAndVisible()
return true return true
} }
......
...@@ -43,12 +43,30 @@ class AppMenuViewController: MenuViewController { ...@@ -43,12 +43,30 @@ class AppMenuViewController: MenuViewController {
/// MenuView inset. /// MenuView inset.
private let menuViewInset: CGFloat = 16 private let menuViewInset: CGFloat = 16
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
init() {
super.init(nibName: nil, bundle: nil)
prepareTabBarItem()
}
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareMenuView() prepareMenuView()
} }
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
closeMenu()
}
override func openMenu(completion: (() -> Void)? = nil) { override func openMenu(completion: (() -> Void)? = nil) {
super.openMenu(completion) super.openMenu(completion)
sideNavigationController?.enabled = false sideNavigationController?.enabled = false
...@@ -97,7 +115,7 @@ class AppMenuViewController: MenuViewController { ...@@ -97,7 +115,7 @@ class AppMenuViewController: MenuViewController {
menuButton.tintColor = MaterialColor.white menuButton.tintColor = MaterialColor.white
menuButton.setImage(image, forState: .Normal) menuButton.setImage(image, forState: .Normal)
menuButton.setImage(image, forState: .Highlighted) menuButton.setImage(image, forState: .Highlighted)
menuButton.addTarget(self, action: "handleMenu", forControlEvents: .TouchUpInside) menuButton.addTarget(self, action: #selector(handleMenu), forControlEvents: .TouchUpInside)
menuView.addSubview(menuButton) menuView.addSubview(menuButton)
image = UIImage(named: "ic_create_white") image = UIImage(named: "ic_create_white")
...@@ -106,7 +124,7 @@ class AppMenuViewController: MenuViewController { ...@@ -106,7 +124,7 @@ class AppMenuViewController: MenuViewController {
blueButton.setImage(image, forState: .Normal) blueButton.setImage(image, forState: .Normal)
blueButton.setImage(image, forState: .Highlighted) blueButton.setImage(image, forState: .Highlighted)
menuView.addSubview(blueButton) menuView.addSubview(blueButton)
blueButton.addTarget(self, action: "handleBlueButton", forControlEvents: .TouchUpInside) blueButton.addTarget(self, action: #selector(handleBlueButton), forControlEvents: .TouchUpInside)
image = UIImage(named: "ic_photo_camera_white") image = UIImage(named: "ic_photo_camera_white")
let greenButton: FabButton = FabButton() let greenButton: FabButton = FabButton()
...@@ -114,7 +132,7 @@ class AppMenuViewController: MenuViewController { ...@@ -114,7 +132,7 @@ class AppMenuViewController: MenuViewController {
greenButton.setImage(image, forState: .Normal) greenButton.setImage(image, forState: .Normal)
greenButton.setImage(image, forState: .Highlighted) greenButton.setImage(image, forState: .Highlighted)
menuView.addSubview(greenButton) menuView.addSubview(greenButton)
greenButton.addTarget(self, action: "handleGreenButton", forControlEvents: .TouchUpInside) greenButton.addTarget(self, action: #selector(handleGreenButton), forControlEvents: .TouchUpInside)
image = UIImage(named: "ic_note_add_white") image = UIImage(named: "ic_note_add_white")
let yellowButton: FabButton = FabButton() let yellowButton: FabButton = FabButton()
...@@ -122,7 +140,7 @@ class AppMenuViewController: MenuViewController { ...@@ -122,7 +140,7 @@ class AppMenuViewController: MenuViewController {
yellowButton.setImage(image, forState: .Normal) yellowButton.setImage(image, forState: .Normal)
yellowButton.setImage(image, forState: .Highlighted) yellowButton.setImage(image, forState: .Highlighted)
menuView.addSubview(yellowButton) menuView.addSubview(yellowButton)
yellowButton.addTarget(self, action: "handleYellowButton", forControlEvents: .TouchUpInside) yellowButton.addTarget(self, action: #selector(handleYellowButton), forControlEvents: .TouchUpInside)
// Initialize the menu and setup the configuration options. // Initialize the menu and setup the configuration options.
menuView.menu.baseViewSize = baseViewSize menuView.menu.baseViewSize = baseViewSize
...@@ -133,5 +151,13 @@ class AppMenuViewController: MenuViewController { ...@@ -133,5 +151,13 @@ class AppMenuViewController: MenuViewController {
MaterialLayout.size(view, child: menuView, width: baseViewSize.width, height: baseViewSize.height) MaterialLayout.size(view, child: menuView, width: baseViewSize.width, height: baseViewSize.height)
MaterialLayout.alignFromBottomRight(view, child: menuView, bottom: menuViewInset, right: menuViewInset) MaterialLayout.alignFromBottomRight(view, child: menuView, bottom: menuViewInset, right: menuViewInset)
} }
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.title = "Recipes"
tabBarItem.image = MaterialIcon.photoLibrary
tabBarItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
tabBarItem.setTitleColor(MaterialColor.lightBlue.base, forState: .Selected)
}
} }
...@@ -60,11 +60,6 @@ class AppRightViewController: UIViewController { ...@@ -60,11 +60,6 @@ class AppRightViewController: UIViewController {
view.backgroundColor = MaterialColor.grey.darken4 view.backgroundColor = MaterialColor.grey.darken4
} }
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
}
/// Prepares the items that are displayed within the tableView. /// Prepares the items that are displayed within the tableView.
private func prepareCells() { private func prepareCells() {
items.append(Item(text: "Recipes", imageName: "ic_inbox")) items.append(Item(text: "Recipes", imageName: "ic_inbox"))
......
...@@ -91,7 +91,7 @@ class AppSearchBarController: SearchBarController { ...@@ -91,7 +91,7 @@ class AppSearchBarController: SearchBarController {
backButton.tintColor = MaterialColor.grey.darken4 backButton.tintColor = MaterialColor.grey.darken4
backButton.setImage(image, forState: .Normal) backButton.setImage(image, forState: .Normal)
backButton.setImage(image, forState: .Highlighted) backButton.setImage(image, forState: .Highlighted)
backButton.addTarget(self, action: "handleBackButton", forControlEvents: .TouchUpInside) backButton.addTarget(self, action: #selector(handleBackButton), forControlEvents: .TouchUpInside)
// More button. // More button.
image = MaterialIcon.moreHorizontal image = MaterialIcon.moreHorizontal
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
"images" : [ "images" : [
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "ic_close_white.png", "filename" : "ic_camera_front_white.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "ic_close_white@2x.png", "filename" : "ic_camera_front_white@2x.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "ic_close_white@3x.png", "filename" : "ic_camera_front_white@3x.png",
"scale" : "3x" "scale" : "3x"
} }
], ],
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_camera_rear_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_camera_rear_white@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_camera_rear_white@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_flash_auto_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_flash_auto_white@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_flash_auto_white@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_flash_off_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_flash_off_white@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_flash_off_white@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_flash_on_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_flash_on_white@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_flash_on_white@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_photo_camera_white_36pt.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_photo_camera_white_36pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_photo_camera_white_36pt@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_videocam_white_36pt.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_videocam_white_36pt@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_videocam_white_36pt@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -108,7 +108,7 @@ class ItemViewController: UIViewController { ...@@ -108,7 +108,7 @@ class ItemViewController: UIViewController {
shareButton.pulseColor = MaterialColor.white shareButton.pulseColor = MaterialColor.white
shareButton.setImage(image, forState: .Normal) shareButton.setImage(image, forState: .Normal)
shareButton.setImage(image, forState: .Highlighted) shareButton.setImage(image, forState: .Highlighted)
shareButton.addTarget(self, action: "handleShareButton", forControlEvents: .TouchUpInside) shareButton.addTarget(self, action: #selector(handleShareButton), forControlEvents: .TouchUpInside)
} }
/// Prepares view. /// Prepares view.
......
/*
* 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
import Material
class PhotoViewController: UIViewController {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
init() {
super.init(nibName: nil, bundle: nil)
prepareTabBarItem()
}
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.green.base
}
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.title = "Photo"
tabBarItem.image = MaterialIcon.photoCamera
tabBarItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
tabBarItem.setTitleColor(MaterialColor.lightBlue.base, forState: .Selected)
}
}
...@@ -68,7 +68,10 @@ class RecipesViewController: UIViewController { ...@@ -68,7 +68,10 @@ class RecipesViewController: UIViewController {
// Enable the SideNavigation. // Enable the SideNavigation.
sideNavigationController?.enabled = true sideNavigationController?.enabled = true
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
// Show the menuView. // Show the menuView.
menuViewController?.menuView.animate(MaterialAnimation.animationGroup([ menuViewController?.menuView.animate(MaterialAnimation.animationGroup([
MaterialAnimation.rotate(rotation: 3), MaterialAnimation.rotate(rotation: 3),
...@@ -155,6 +158,54 @@ class RecipesViewController: UIViewController { ...@@ -155,6 +158,54 @@ class RecipesViewController: UIViewController {
"date": "February 26, 2016", "date": "February 26, 2016",
"image": "VeganPieAbove" "image": "VeganPieAbove"
] ]
),
MaterialDataSourceItem(
data: [
"title": "Crepe Indulgence",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "AssortmentOfDessert"
]
),
MaterialDataSourceItem(
data: [
"title": "Avocado Chocolate Cake",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "AssortmentOfFood"
]
),
MaterialDataSourceItem(
data: [
"title": "Avocado Ice-Cream",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "AvocadoIceCream"
]
),
MaterialDataSourceItem(
data: [
"title": "Raw Vegan Chocolate Cookies",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "HeartCookies"
]
),
MaterialDataSourceItem(
data: [
"title": "Raw Vegan Nutty Sweets",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "VeganHempBalls"
]
),
MaterialDataSourceItem(
data: [
"title": "Blueberry Tart",
"detail": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"date": "February 26, 2016",
"image": "VeganPieAbove"
]
) )
] ]
} }
...@@ -180,7 +231,7 @@ class RecipesViewController: UIViewController { ...@@ -180,7 +231,7 @@ class RecipesViewController: UIViewController {
menuButton.pulseColor = MaterialColor.white menuButton.pulseColor = MaterialColor.white
menuButton.setImage(image, forState: .Normal) menuButton.setImage(image, forState: .Normal)
menuButton.setImage(image, forState: .Highlighted) menuButton.setImage(image, forState: .Highlighted)
menuButton.addTarget(self, action: "handleMenuButton", forControlEvents: .TouchUpInside) menuButton.addTarget(self, action: #selector(handleMenuButton), forControlEvents: .TouchUpInside)
} }
/// Prepares the switchControl. /// Prepares the switchControl.
...@@ -196,7 +247,7 @@ class RecipesViewController: UIViewController { ...@@ -196,7 +247,7 @@ class RecipesViewController: UIViewController {
searchButton.pulseColor = MaterialColor.white searchButton.pulseColor = MaterialColor.white
searchButton.setImage(image, forState: .Normal) searchButton.setImage(image, forState: .Normal)
searchButton.setImage(image, forState: .Highlighted) searchButton.setImage(image, forState: .Highlighted)
searchButton.addTarget(self, action: "handleSearchButton", forControlEvents: .TouchUpInside) searchButton.addTarget(self, action: #selector(handleSearchButton), forControlEvents: .TouchUpInside)
} }
/// Prepares the NavigationBar. /// Prepares the NavigationBar.
......
/*
* 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
import Material
class VideoViewController: UIViewController {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
init() {
super.init(nibName: nil, bundle: nil)
prepareTabBarItem()
}
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
}
/// General preparation statements.
private func prepareView() {
view.backgroundColor = MaterialColor.yellow.base
}
/// Prepare tabBarItem.
private func prepareTabBarItem() {
tabBarItem.title = "Video"
tabBarItem.image = MaterialIcon.videocam
tabBarItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
tabBarItem.setTitleColor(MaterialColor.lightBlue.base, forState: .Selected)
}
}
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
96A536751CA3A5450069B3CC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A536741CA3A5450069B3CC /* ViewController.swift */; }; 96A536751CA3A5450069B3CC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A536741CA3A5450069B3CC /* ViewController.swift */; };
96A5367A1CA3A5450069B3CC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96A536791CA3A5450069B3CC /* Assets.xcassets */; }; 96A5367A1CA3A5450069B3CC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96A536791CA3A5450069B3CC /* Assets.xcassets */; };
96A5367D1CA3A5450069B3CC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96A5367B1CA3A5450069B3CC /* LaunchScreen.storyboard */; }; 96A5367D1CA3A5450069B3CC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96A5367B1CA3A5450069B3CC /* LaunchScreen.storyboard */; };
96BAECE51CA3B0F10048037C /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96BAECE41CA3B0F10048037C /* Material.framework */; };
96BAECE61CA3B0F10048037C /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96BAECE41CA3B0F10048037C /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
...@@ -22,7 +20,6 @@ ...@@ -22,7 +20,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
96BAECE61CA3B0F10048037C /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -36,7 +33,6 @@ ...@@ -36,7 +33,6 @@
96A536791CA3A5450069B3CC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 96A536791CA3A5450069B3CC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
96A5367C1CA3A5450069B3CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 96A5367C1CA3A5450069B3CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
96A5367E1CA3A5450069B3CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 96A5367E1CA3A5450069B3CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
96BAECE41CA3B0F10048037C /* 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 */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -44,7 +40,6 @@ ...@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96BAECE51CA3B0F10048037C /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -54,7 +49,6 @@ ...@@ -54,7 +49,6 @@
96A536661CA3A5450069B3CC = { 96A536661CA3A5450069B3CC = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96BAECE41CA3B0F10048037C /* Material.framework */,
96A536711CA3A5450069B3CC /* BottomNavigationBar */, 96A536711CA3A5450069B3CC /* BottomNavigationBar */,
96A536701CA3A5450069B3CC /* Products */, 96A536701CA3A5450069B3CC /* Products */,
); );
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
96162C341CA7064900E3A235 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96162C321CA7064900E3A235 /* Main.storyboard */; }; 96162C341CA7064900E3A235 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96162C321CA7064900E3A235 /* Main.storyboard */; };
96162C361CA7064900E3A235 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96162C351CA7064900E3A235 /* Assets.xcassets */; }; 96162C361CA7064900E3A235 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96162C351CA7064900E3A235 /* Assets.xcassets */; };
96162C391CA7064900E3A235 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96162C371CA7064900E3A235 /* LaunchScreen.storyboard */; }; 96162C391CA7064900E3A235 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96162C371CA7064900E3A235 /* LaunchScreen.storyboard */; };
96162C411CA7068900E3A235 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 96162C401CA7068900E3A235 /* Material.framework */; };
96162C421CA7068900E3A235 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 96162C401CA7068900E3A235 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96162C451CA7083000E3A235 /* PhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C441CA7083000E3A235 /* PhotoViewController.swift */; }; 96162C451CA7083000E3A235 /* PhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C441CA7083000E3A235 /* PhotoViewController.swift */; };
96162C471CA708B000E3A235 /* LibraryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C461CA708B000E3A235 /* LibraryViewController.swift */; }; 96162C471CA708B000E3A235 /* LibraryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C461CA708B000E3A235 /* LibraryViewController.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -25,7 +23,6 @@ ...@@ -25,7 +23,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
96162C421CA7068900E3A235 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -40,7 +37,6 @@ ...@@ -40,7 +37,6 @@
96162C351CA7064900E3A235 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 96162C351CA7064900E3A235 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
96162C381CA7064900E3A235 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 96162C381CA7064900E3A235 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
96162C3A1CA7064900E3A235 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 96162C3A1CA7064900E3A235 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
96162C401CA7068900E3A235 /* 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>"; };
96162C441CA7083000E3A235 /* PhotoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoViewController.swift; sourceTree = "<group>"; }; 96162C441CA7083000E3A235 /* PhotoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoViewController.swift; sourceTree = "<group>"; };
96162C461CA708B000E3A235 /* LibraryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibraryViewController.swift; sourceTree = "<group>"; }; 96162C461CA708B000E3A235 /* LibraryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibraryViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
...@@ -50,7 +46,6 @@ ...@@ -50,7 +46,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96162C411CA7068900E3A235 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -60,7 +55,6 @@ ...@@ -60,7 +55,6 @@
96162C221CA7064900E3A235 = { 96162C221CA7064900E3A235 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96162C401CA7068900E3A235 /* Material.framework */,
96162C2D1CA7064900E3A235 /* BottomNavigationController */, 96162C2D1CA7064900E3A235 /* BottomNavigationController */,
96162C2C1CA7064900E3A235 /* Products */, 96162C2C1CA7064900E3A235 /* Products */,
); );
......
...@@ -38,7 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -38,7 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let bottomNavigationController: BottomNavigationController = BottomNavigationController() let bottomNavigationController: BottomNavigationController = BottomNavigationController()
bottomNavigationController.setViewControllers([VideoViewController(), PhotoViewController(), LibraryViewController()], animated: true) bottomNavigationController.viewControllers = [VideoViewController(), PhotoViewController(), LibraryViewController()]
bottomNavigationController.selectedIndex = 0 bottomNavigationController.selectedIndex = 0
bottomNavigationController.tabBar.tintColor = MaterialColor.teal.base bottomNavigationController.tabBar.tintColor = MaterialColor.teal.base
bottomNavigationController.tabBar.backgroundColor = MaterialColor.grey.darken4 bottomNavigationController.tabBar.backgroundColor = MaterialColor.grey.darken4
......
...@@ -131,7 +131,7 @@ class ViewController: UIViewController { ...@@ -131,7 +131,7 @@ class ViewController: UIViewController {
btn1.pulseColor = nil btn1.pulseColor = nil
btn1.setImage(image, forState: .Normal) btn1.setImage(image, forState: .Normal)
btn1.setImage(image, forState: .Highlighted) btn1.setImage(image, forState: .Highlighted)
btn1.addTarget(self, action: "handleFabMenu", forControlEvents: .TouchUpInside) btn1.addTarget(self, action: #selector(handleFabMenu), forControlEvents: .TouchUpInside)
view.addSubview(btn1) view.addSubview(btn1)
image = UIImage(named: "ic_create_white") image = UIImage(named: "ic_create_white")
...@@ -165,7 +165,7 @@ class ViewController: UIViewController { ...@@ -165,7 +165,7 @@ class ViewController: UIViewController {
/// Prepares the FlatMenu example. /// Prepares the FlatMenu example.
private func prepareFlatbMenuExample() { private func prepareFlatbMenuExample() {
let btn1: FlatButton = FlatButton() let btn1: FlatButton = FlatButton()
btn1.addTarget(self, action: "handleFlatMenu", forControlEvents: .TouchUpInside) btn1.addTarget(self, action: #selector(handleFlatMenu), forControlEvents: .TouchUpInside)
btn1.setTitleColor(MaterialColor.white, forState: .Normal) btn1.setTitleColor(MaterialColor.white, forState: .Normal)
btn1.backgroundColor = MaterialColor.blue.accent3 btn1.backgroundColor = MaterialColor.blue.accent3
btn1.pulseColor = MaterialColor.white btn1.pulseColor = MaterialColor.white
...@@ -212,7 +212,7 @@ class ViewController: UIViewController { ...@@ -212,7 +212,7 @@ class ViewController: UIViewController {
btn1.tintColor = MaterialColor.blueGrey.darken4 btn1.tintColor = MaterialColor.blueGrey.darken4
btn1.setImage(image, forState: .Normal) btn1.setImage(image, forState: .Normal)
btn1.setImage(image, forState: .Highlighted) btn1.setImage(image, forState: .Highlighted)
btn1.addTarget(self, action: "handleFlashMenu", forControlEvents: .TouchUpInside) btn1.addTarget(self, action: #selector(handleFlashMenu), forControlEvents: .TouchUpInside)
view.addSubview(btn1) view.addSubview(btn1)
image = UIImage(named: "ic_flash_off_white")?.imageWithRenderingMode(.AlwaysTemplate) image = UIImage(named: "ic_flash_off_white")?.imageWithRenderingMode(.AlwaysTemplate)
......
...@@ -69,6 +69,7 @@ class ViewController: UIViewController { ...@@ -69,6 +69,7 @@ class ViewController: UIViewController {
} }
/// Handle the menuView touch event. /// Handle the menuView touch event.
@objc(handleButton:)
internal func handleButton(button: UIButton) { internal func handleButton(button: UIButton) {
print("Hit Button \(button)") print("Hit Button \(button)")
} }
...@@ -90,7 +91,7 @@ class ViewController: UIViewController { ...@@ -90,7 +91,7 @@ class ViewController: UIViewController {
btn1.borderWidth = 1 btn1.borderWidth = 1
btn1.setImage(image, forState: .Normal) btn1.setImage(image, forState: .Normal)
btn1.setImage(image, forState: .Highlighted) btn1.setImage(image, forState: .Highlighted)
btn1.addTarget(self, action: "handleMenu", forControlEvents: .TouchUpInside) btn1.addTarget(self, action: #selector(handleMenu), forControlEvents: .TouchUpInside)
menuView.addSubview(btn1) menuView.addSubview(btn1)
image = UIImage(named: "ic_create_white")?.imageWithRenderingMode(.AlwaysTemplate) image = UIImage(named: "ic_create_white")?.imageWithRenderingMode(.AlwaysTemplate)
...@@ -103,7 +104,7 @@ class ViewController: UIViewController { ...@@ -103,7 +104,7 @@ class ViewController: UIViewController {
btn2.borderWidth = 1 btn2.borderWidth = 1
btn2.setImage(image, forState: .Normal) btn2.setImage(image, forState: .Normal)
btn2.setImage(image, forState: .Highlighted) btn2.setImage(image, forState: .Highlighted)
btn2.addTarget(self, action: "handleButton:", forControlEvents: .TouchUpInside) btn2.addTarget(self, action: #selector(handleButton(_:)), forControlEvents: .TouchUpInside)
menuView.addSubview(btn2) menuView.addSubview(btn2)
image = UIImage(named: "ic_photo_camera_white")?.imageWithRenderingMode(.AlwaysTemplate) image = UIImage(named: "ic_photo_camera_white")?.imageWithRenderingMode(.AlwaysTemplate)
...@@ -116,7 +117,7 @@ class ViewController: UIViewController { ...@@ -116,7 +117,7 @@ class ViewController: UIViewController {
btn3.borderWidth = 1 btn3.borderWidth = 1
btn3.setImage(image, forState: .Normal) btn3.setImage(image, forState: .Normal)
btn3.setImage(image, forState: .Highlighted) btn3.setImage(image, forState: .Highlighted)
btn3.addTarget(self, action: "handleButton:", forControlEvents: .TouchUpInside) btn3.addTarget(self, action: #selector(handleButton(_:)), forControlEvents: .TouchUpInside)
menuView.addSubview(btn3) menuView.addSubview(btn3)
image = UIImage(named: "ic_note_add_white")?.imageWithRenderingMode(.AlwaysTemplate) image = UIImage(named: "ic_note_add_white")?.imageWithRenderingMode(.AlwaysTemplate)
...@@ -129,7 +130,7 @@ class ViewController: UIViewController { ...@@ -129,7 +130,7 @@ class ViewController: UIViewController {
btn4.borderWidth = 1 btn4.borderWidth = 1
btn4.setImage(image, forState: .Normal) btn4.setImage(image, forState: .Normal)
btn4.setImage(image, forState: .Highlighted) btn4.setImage(image, forState: .Highlighted)
btn4.addTarget(self, action: "handleButton:", forControlEvents: .TouchUpInside) btn4.addTarget(self, action: #selector(handleButton(_:)), forControlEvents: .TouchUpInside)
menuView.addSubview(btn4) menuView.addSubview(btn4)
// Initialize the menu and setup the configuration options. // Initialize the menu and setup the configuration options.
......
...@@ -104,7 +104,7 @@ class AppMenuViewController: MenuViewController { ...@@ -104,7 +104,7 @@ class AppMenuViewController: MenuViewController {
let btn1: FabButton = FabButton() let btn1: FabButton = FabButton()
btn1.setImage(image, forState: .Normal) btn1.setImage(image, forState: .Normal)
btn1.setImage(image, forState: .Highlighted) btn1.setImage(image, forState: .Highlighted)
btn1.addTarget(self, action: "handleMenu", forControlEvents: .TouchUpInside) btn1.addTarget(self, action: #selector(handleMenu), forControlEvents: .TouchUpInside)
menuView.addSubview(btn1) menuView.addSubview(btn1)
image = UIImage(named: "ic_create_white") image = UIImage(named: "ic_create_white")
...@@ -113,7 +113,7 @@ class AppMenuViewController: MenuViewController { ...@@ -113,7 +113,7 @@ class AppMenuViewController: MenuViewController {
btn2.setImage(image, forState: .Normal) btn2.setImage(image, forState: .Normal)
btn2.setImage(image, forState: .Highlighted) btn2.setImage(image, forState: .Highlighted)
menuView.addSubview(btn2) menuView.addSubview(btn2)
btn2.addTarget(self, action: "handleBlueButton", forControlEvents: .TouchUpInside) btn2.addTarget(self, action: #selector(handleBlueButton), forControlEvents: .TouchUpInside)
image = UIImage(named: "ic_photo_camera_white") image = UIImage(named: "ic_photo_camera_white")
let btn3: FabButton = FabButton() let btn3: FabButton = FabButton()
...@@ -121,7 +121,7 @@ class AppMenuViewController: MenuViewController { ...@@ -121,7 +121,7 @@ class AppMenuViewController: MenuViewController {
btn3.setImage(image, forState: .Normal) btn3.setImage(image, forState: .Normal)
btn3.setImage(image, forState: .Highlighted) btn3.setImage(image, forState: .Highlighted)
menuView.addSubview(btn3) menuView.addSubview(btn3)
btn3.addTarget(self, action: "handleGreenButton", forControlEvents: .TouchUpInside) btn3.addTarget(self, action: #selector(handleGreenButton), forControlEvents: .TouchUpInside)
image = UIImage(named: "ic_note_add_white") image = UIImage(named: "ic_note_add_white")
let btn4: FabButton = FabButton() let btn4: FabButton = FabButton()
...@@ -129,7 +129,7 @@ class AppMenuViewController: MenuViewController { ...@@ -129,7 +129,7 @@ class AppMenuViewController: MenuViewController {
btn4.setImage(image, forState: .Normal) btn4.setImage(image, forState: .Normal)
btn4.setImage(image, forState: .Highlighted) btn4.setImage(image, forState: .Highlighted)
menuView.addSubview(btn4) menuView.addSubview(btn4)
btn4.addTarget(self, action: "handleYellowButton", forControlEvents: .TouchUpInside) btn4.addTarget(self, action: #selector(handleYellowButton), forControlEvents: .TouchUpInside)
// Initialize the menu and setup the configuration options. // Initialize the menu and setup the configuration options.
menuView.menu.baseViewSize = baseViewSize menuView.menu.baseViewSize = baseViewSize
......
...@@ -84,7 +84,7 @@ class AppSearchBarController: SearchBarController { ...@@ -84,7 +84,7 @@ class AppSearchBarController: SearchBarController {
clearButton.tintColor = MaterialColor.blueGrey.darken4 clearButton.tintColor = MaterialColor.blueGrey.darken4
clearButton.setImage(image, forState: .Normal) clearButton.setImage(image, forState: .Normal)
clearButton.setImage(image, forState: .Highlighted) clearButton.setImage(image, forState: .Highlighted)
clearButton.addTarget(self, action: "handleYellowButton", forControlEvents: .TouchUpInside) clearButton.addTarget(self, action: #selector(handleYellowButton), forControlEvents: .TouchUpInside)
// Back button. // Back button.
image = MaterialIcon.arrowBack image = MaterialIcon.arrowBack
...@@ -94,7 +94,7 @@ class AppSearchBarController: SearchBarController { ...@@ -94,7 +94,7 @@ class AppSearchBarController: SearchBarController {
backButton.tintColor = MaterialColor.blueGrey.darken4 backButton.tintColor = MaterialColor.blueGrey.darken4
backButton.setImage(image, forState: .Normal) backButton.setImage(image, forState: .Normal)
backButton.setImage(image, forState: .Highlighted) backButton.setImage(image, forState: .Highlighted)
backButton.addTarget(self, action: "handleBlueButton", forControlEvents: .TouchUpInside) backButton.addTarget(self, action: #selector(handleBlueButton), forControlEvents: .TouchUpInside)
// More button. // More button.
image = MaterialIcon.moreHorizontal image = MaterialIcon.moreHorizontal
...@@ -104,7 +104,7 @@ class AppSearchBarController: SearchBarController { ...@@ -104,7 +104,7 @@ class AppSearchBarController: SearchBarController {
moreButton.tintColor = MaterialColor.blueGrey.darken4 moreButton.tintColor = MaterialColor.blueGrey.darken4
moreButton.setImage(image, forState: .Normal) moreButton.setImage(image, forState: .Normal)
moreButton.setImage(image, forState: .Highlighted) moreButton.setImage(image, forState: .Highlighted)
moreButton.addTarget(self, action: "handleGreenButton", forControlEvents: .TouchUpInside) moreButton.addTarget(self, action: #selector(handleGreenButton), forControlEvents: .TouchUpInside)
/* /*
To lighten the status bar - add the To lighten the status bar - add the
......
...@@ -100,7 +100,7 @@ class AppToolbarController: ToolbarController { ...@@ -100,7 +100,7 @@ class AppToolbarController: ToolbarController {
menuButton.tintColor = MaterialColor.white menuButton.tintColor = MaterialColor.white
menuButton.setImage(image, forState: .Normal) menuButton.setImage(image, forState: .Normal)
menuButton.setImage(image, forState: .Highlighted) menuButton.setImage(image, forState: .Highlighted)
menuButton.addTarget(self, action: "handleMenuButton", forControlEvents: .TouchUpInside) menuButton.addTarget(self, action: #selector(handleMenuButton), forControlEvents: .TouchUpInside)
// Switch control. // Switch control.
let switchControl: MaterialSwitch = MaterialSwitch(state: .Off, style: .LightContent, size: .Small) let switchControl: MaterialSwitch = MaterialSwitch(state: .Off, style: .LightContent, size: .Small)
...@@ -114,7 +114,7 @@ class AppToolbarController: ToolbarController { ...@@ -114,7 +114,7 @@ class AppToolbarController: ToolbarController {
searchButton.tintColor = MaterialColor.white searchButton.tintColor = MaterialColor.white
searchButton.setImage(image, forState: .Normal) searchButton.setImage(image, forState: .Normal)
searchButton.setImage(image, forState: .Highlighted) searchButton.setImage(image, forState: .Highlighted)
searchButton.addTarget(self, action: "handleSearchButton", forControlEvents: .TouchUpInside) searchButton.addTarget(self, action: #selector(handleSearchButton), forControlEvents: .TouchUpInside)
toolbar.backgroundColor = MaterialColor.blue.base toolbar.backgroundColor = MaterialColor.blue.base
toolbar.titleLabel = titleLabel toolbar.titleLabel = titleLabel
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--View Controller--> <!--View Controller-->
...@@ -17,11 +17,8 @@ ...@@ -17,11 +17,8 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/> <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<tabBar contentMode="scaleToFill" misplaced="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sMP-AS-Zl9" customClass="BottomNavigationBar" customModule="Material"> <tabBar contentMode="scaleToFill" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sMP-AS-Zl9" customClass="BottomNavigationBar" customModule="Material">
<rect key="frame" x="0.0" y="551" width="600" height="49"/> <rect key="frame" x="0.0" y="551" width="600" height="49"/>
<constraints>
<constraint firstAttribute="height" constant="56" id="2xR-RQ-MBH"/>
</constraints>
<items> <items>
<tabBarItem title="Video" id="BkO-Yq-m1c" customClass="BottomNavigationBarItem" customModule="Material"/> <tabBarItem title="Video" id="BkO-Yq-m1c" customClass="BottomNavigationBarItem" customModule="Material"/>
<tabBarItem title="Photo" id="vsG-AI-jYq" customClass="BottomNavigationBarItem" customModule="Material"/> <tabBarItem title="Photo" id="vsG-AI-jYq" customClass="BottomNavigationBarItem" customModule="Material"/>
......
...@@ -41,7 +41,7 @@ class MainViewController: UIViewController { ...@@ -41,7 +41,7 @@ class MainViewController: UIViewController {
let fabButton: FabButton = FabButton() let fabButton: FabButton = FabButton()
fabButton.setImage(img, forState: .Normal) fabButton.setImage(img, forState: .Normal)
fabButton.setImage(img, forState: .Highlighted) fabButton.setImage(img, forState: .Highlighted)
fabButton.addTarget(self, action: "handleFabButton", forControlEvents: .TouchUpInside) fabButton.addTarget(self, action: #selector(handleFabButton), forControlEvents: .TouchUpInside)
view.addSubview(fabButton) view.addSubview(fabButton)
fabButton.translatesAutoresizingMaskIntoConstraints = false fabButton.translatesAutoresizingMaskIntoConstraints = false
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '1.37.3' s.version = '1.38.0'
s.license = 'BSD' s.license = 'BSD'
s.summary = 'Express your creativity with Material, an animation and graphics framework for Google\'s Material Design and Apple\'s Flat UI in Swift.' s.summary = 'Express your creativity with Material, an animation and graphics framework for Google\'s Material Design and Apple\'s Flat UI in Swift.'
s.homepage = 'http://cosmicmind.io' s.homepage = 'http://cosmicmind.io'
......
...@@ -109,6 +109,8 @@ Material is a growing project and will encounter changes throughout its developm ...@@ -109,6 +109,8 @@ Material is a growing project and will encounter changes throughout its developm
* [ToolbarController](#toolbarcontroller) * [ToolbarController](#toolbarcontroller)
* [SearchBar](#searchbar) * [SearchBar](#searchbar)
* [SearchBarController](#searchbarcontroller) * [SearchBarController](#searchbarcontroller)
* BottomNavigationBar
* BottomNavigationController
* [SideNavigationController](#sidenavigationcontroller) * [SideNavigationController](#sidenavigationcontroller)
#### Photo / Video Camera #### Photo / Video Camera
......
...@@ -198,15 +198,16 @@ public class BottomNavigationBar : UITabBar { ...@@ -198,15 +198,16 @@ public class BottomNavigationBar : UITabBar {
if let v: Array<UITabBarItem> = items { if let v: Array<UITabBarItem> = items {
for item in v { for item in v {
if nil == item.title { if nil == item.title {
item.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0) item.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0)
} else { } else {
item.titlePositionAdjustment.vertical = -8 item.titlePositionAdjustment.vertical = -5
} }
} }
} }
if translatesAutoresizingMaskIntoConstraints { if translatesAutoresizingMaskIntoConstraints {
if let v: UIView = superview { if let v: UIView = superview {
frame = CGRectMake(0, v.bounds.height - 56, v.bounds.width, 56) let h: CGFloat = intrinsicContentSize().height
frame = CGRectMake(0, v.bounds.height - h, v.bounds.width, h)
} }
} }
} }
...@@ -221,8 +222,9 @@ public class BottomNavigationBar : UITabBar { ...@@ -221,8 +222,9 @@ public class BottomNavigationBar : UITabBar {
public func prepareView() { public func prepareView() {
depth = .Depth1 depth = .Depth1
backgroundColor = MaterialColor.white backgroundColor = MaterialColor.white
shadowImage = UIImage.imageWithColor(MaterialColor.clear, size: CGSizeMake(1, 1)) let image: UIImage? = UIImage.imageWithColor(MaterialColor.clear, size: CGSizeMake(1, 1))
backgroundImage = UIImage() shadowImage = image
backgroundImage = image
} }
} }
......
...@@ -30,8 +30,39 @@ ...@@ -30,8 +30,39 @@
import UIKit import UIKit
public class BottomNavigationFadeAnimatedTransitioning : NSObject, UIViewControllerAnimatedTransitioning {
public func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
let fromView : UIView = transitionContext.viewForKey(UITransitionContextFromViewKey)!
let toView : UIView = transitionContext.viewForKey(UITransitionContextToViewKey)!
toView.alpha = 0
transitionContext.containerView()!.addSubview(fromView)
transitionContext.containerView()!.addSubview(toView)
UIView.animateWithDuration(transitionDuration(transitionContext),
animations: { _ in
toView.alpha = 1
fromView.alpha = 0
}) { _ in
transitionContext.completeTransition(true)
}
}
public func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
return 0.35
}
}
public enum BottomNavigationTransitionAnimation {
case None
case Fade
}
@IBDesignable @IBDesignable
public class BottomNavigationController : UITabBarController { public class BottomNavigationController : UITabBarController, UITabBarControllerDelegate {
/// The transition animation to use when selecting a new tab.
public var transitionAnimation: BottomNavigationTransitionAnimation = .Fade
/** /**
An initializer that initializes the object with a NSCoder object. An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance. - Parameter aDecoder: A NSCoder instance.
...@@ -60,15 +91,19 @@ public class BottomNavigationController : UITabBarController { ...@@ -60,15 +91,19 @@ public class BottomNavigationController : UITabBarController {
} }
public func layoutSubviews() { public func layoutSubviews() {
tabBar.frame = CGRectMake(0, view.bounds.height - 56, view.bounds.width, 56)
if let v: Array<UITabBarItem> = tabBar.items { if let v: Array<UITabBarItem> = tabBar.items {
for item in v { for item in v {
if nil == item.title { if nil == item.title {
item.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0) item.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0)
} else { } else {
item.titlePositionAdjustment.vertical = -8 item.titlePositionAdjustment.vertical = -5
}
} }
} }
if let v: Array<UIViewController> = viewControllers {
for controller in v {
controller.edgesForExtendedLayout = .None
}
} }
} }
...@@ -80,9 +115,14 @@ public class BottomNavigationController : UITabBarController { ...@@ -80,9 +115,14 @@ public class BottomNavigationController : UITabBarController {
when subclassing. when subclassing.
*/ */
public func prepareView() { public func prepareView() {
delegate = self
tabBar.depth = .Depth1 tabBar.depth = .Depth1
tabBar.backgroundColor = MaterialColor.white tabBar.backgroundColor = MaterialColor.white
tabBar.shadowImage = UIImage.imageWithColor(MaterialColor.clear, size: CGSizeMake(1, 1)) tabBar.shadowImage = UIImage.imageWithColor(MaterialColor.clear, size: CGSizeMake(1, 1))
tabBar.backgroundImage = UIImage() tabBar.backgroundImage = UIImage()
} }
public func tabBarController(tabBarController: UITabBarController, animationControllerForTransitionFromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return .Fade == transitionAnimation ? BottomNavigationFadeAnimatedTransitioning() : nil
}
} }
...@@ -128,7 +128,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -128,7 +128,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
if tapToFocusEnabled { if tapToFocusEnabled {
tapToResetEnabled = true tapToResetEnabled = true
prepareFocusLayer() prepareFocusLayer()
prepareTapGesture(&tapToFocusGesture, numberOfTapsRequired: 1, numberOfTouchesRequired: 1, selector: "handleTapToFocusGesture:") prepareTapGesture(&tapToFocusGesture, numberOfTapsRequired: 1, numberOfTouchesRequired: 1, selector: #selector(handleTapToFocusGesture(_:)))
if let v: UITapGestureRecognizer = tapToExposeGesture { if let v: UITapGestureRecognizer = tapToExposeGesture {
tapToFocusGesture!.requireGestureRecognizerToFail(v) tapToFocusGesture!.requireGestureRecognizerToFail(v)
} }
...@@ -148,7 +148,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -148,7 +148,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
if tapToExposeEnabled { if tapToExposeEnabled {
tapToResetEnabled = true tapToResetEnabled = true
prepareExposureLayer() prepareExposureLayer()
prepareTapGesture(&tapToExposeGesture, numberOfTapsRequired: 2, numberOfTouchesRequired: 1, selector: "handleTapToExposeGesture:") prepareTapGesture(&tapToExposeGesture, numberOfTapsRequired: 2, numberOfTouchesRequired: 1, selector: #selector(handleTapToExposeGesture(_:)))
if let v: UITapGestureRecognizer = tapToFocusGesture { if let v: UITapGestureRecognizer = tapToFocusGesture {
v.requireGestureRecognizerToFail(tapToExposeGesture!) v.requireGestureRecognizerToFail(tapToExposeGesture!)
} }
...@@ -167,7 +167,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -167,7 +167,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
didSet { didSet {
if tapToResetEnabled { if tapToResetEnabled {
prepareResetLayer() prepareResetLayer()
prepareTapGesture(&tapToResetGesture, numberOfTapsRequired: 2, numberOfTouchesRequired: 2, selector: "handleTapToResetGesture:") prepareTapGesture(&tapToResetGesture, numberOfTapsRequired: 2, numberOfTouchesRequired: 2, selector: #selector(handleTapToResetGesture(_:)))
if let v: UITapGestureRecognizer = tapToFocusGesture { if let v: UITapGestureRecognizer = tapToFocusGesture {
v.requireGestureRecognizerToFail(tapToResetGesture!) v.requireGestureRecognizerToFail(tapToResetGesture!)
} }
...@@ -231,7 +231,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -231,7 +231,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
public var cameraButton: UIButton? { public var cameraButton: UIButton? {
didSet { didSet {
if let v: UIButton = cameraButton { if let v: UIButton = cameraButton {
v.addTarget(self, action: "handleCameraButton:", forControlEvents: .TouchUpInside) v.addTarget(self, action: #selector(handleCameraButton), forControlEvents: .TouchUpInside)
} }
reloadView() reloadView()
} }
...@@ -243,7 +243,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -243,7 +243,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
public var captureButton: UIButton? { public var captureButton: UIButton? {
didSet { didSet {
if let v: UIButton = captureButton { if let v: UIButton = captureButton {
v.addTarget(self, action: "handleCaptureButton:", forControlEvents: .TouchUpInside) v.addTarget(self, action: #selector(handleCaptureButton), forControlEvents: .TouchUpInside)
} }
reloadView() reloadView()
} }
...@@ -256,7 +256,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -256,7 +256,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
public var videoButton: UIButton? { public var videoButton: UIButton? {
didSet { didSet {
if let v: UIButton = videoButton { if let v: UIButton = videoButton {
v.addTarget(self, action: "handleVideoButton:", forControlEvents: .TouchUpInside) v.addTarget(self, action: #selector(handleVideoButton), forControlEvents: .TouchUpInside)
} }
reloadView() reloadView()
} }
...@@ -268,7 +268,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -268,7 +268,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
public var switchCamerasButton: UIButton? { public var switchCamerasButton: UIButton? {
didSet { didSet {
if let v: UIButton = switchCamerasButton { if let v: UIButton = switchCamerasButton {
v.addTarget(self, action: "handleSwitchCamerasButton:", forControlEvents: .TouchUpInside) v.addTarget(self, action: #selector(handleSwitchCamerasButton), forControlEvents: .TouchUpInside)
} }
} }
} }
...@@ -279,7 +279,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -279,7 +279,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
public var flashButton: UIButton? { public var flashButton: UIButton? {
didSet { didSet {
if let v: UIButton = flashButton { if let v: UIButton = flashButton {
v.addTarget(self, action: "handleFlashButton:", forControlEvents: .TouchUpInside) v.addTarget(self, action: #selector(handleFlashButton), forControlEvents: .TouchUpInside)
} }
} }
} }
...@@ -354,7 +354,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -354,7 +354,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
*/ */
internal func startTimer() { internal func startTimer() {
timer?.invalidate() timer?.invalidate()
timer = NSTimer(timeInterval: 0.5, target: self, selector: "updateTimer", userInfo: nil, repeats: true) timer = NSTimer(timeInterval: 0.5, target: self, selector: #selector(updateTimer), userInfo: nil, repeats: true)
NSRunLoop.mainRunLoop().addTimer(timer!, forMode: NSRunLoopCommonModes) NSRunLoop.mainRunLoop().addTimer(timer!, forMode: NSRunLoopCommonModes)
(delegate as? CaptureViewDelegate)?.captureViewDidStartRecordTimer?(self) (delegate as? CaptureViewDelegate)?.captureViewDidStartRecordTimer?(self)
} }
...@@ -437,6 +437,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -437,6 +437,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
/** /**
:name: handleTapToFocusGesture :name: handleTapToFocusGesture
*/ */
@objc(handleTapToFocusGesture:)
internal func handleTapToFocusGesture(recognizer: UITapGestureRecognizer) { internal func handleTapToFocusGesture(recognizer: UITapGestureRecognizer) {
if tapToFocusEnabled && captureSession.cameraSupportsTapToFocus { if tapToFocusEnabled && captureSession.cameraSupportsTapToFocus {
let point: CGPoint = recognizer.locationInView(self) let point: CGPoint = recognizer.locationInView(self)
...@@ -449,6 +450,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -449,6 +450,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
/** /**
:name: handleTapToExposeGesture :name: handleTapToExposeGesture
*/ */
@objc(handleTapToExposeGesture:)
internal func handleTapToExposeGesture(recognizer: UITapGestureRecognizer) { internal func handleTapToExposeGesture(recognizer: UITapGestureRecognizer) {
if tapToExposeEnabled && captureSession.cameraSupportsTapToExpose { if tapToExposeEnabled && captureSession.cameraSupportsTapToExpose {
let point: CGPoint = recognizer.locationInView(self) let point: CGPoint = recognizer.locationInView(self)
...@@ -461,6 +463,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -461,6 +463,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
/** /**
:name: handleTapToResetGesture :name: handleTapToResetGesture
*/ */
@objc(handleTapToResetGesture:)
internal func handleTapToResetGesture(recognizer: UITapGestureRecognizer) { internal func handleTapToResetGesture(recognizer: UITapGestureRecognizer) {
if tapToResetEnabled { if tapToResetEnabled {
captureSession.resetFocusAndExposureModes() captureSession.resetFocusAndExposureModes()
......
...@@ -338,16 +338,12 @@ public class MaterialSwitch : UIControl { ...@@ -338,16 +338,12 @@ public class MaterialSwitch : UIControl {
} }
} }
/// Handles the TouchUpInside event.
internal func handleTouchUpInside() {
toggle()
}
/** /**
Handle the TouchUpOutside and TouchCancel events. Handle the TouchUpOutside and TouchCancel events.
- Parameter sender: A UIButton. - Parameter sender: A UIButton.
- Parameter event: A UIEvent. - Parameter event: A UIEvent.
*/ */
@objc(handleTouchUpOutsideOrCanceled:event:)
internal func handleTouchUpOutsideOrCanceled(sender: FabButton, event: UIEvent) { internal func handleTouchUpOutsideOrCanceled(sender: FabButton, event: UIEvent) {
if let v: UITouch = event.touchesForView(sender)?.first { if let v: UITouch = event.touchesForView(sender)?.first {
let q: CGFloat = sender.x + v.locationInView(sender).x - v.previousLocationInView(sender).x let q: CGFloat = sender.x + v.locationInView(sender).x - v.previousLocationInView(sender).x
...@@ -355,11 +351,17 @@ public class MaterialSwitch : UIControl { ...@@ -355,11 +351,17 @@ public class MaterialSwitch : UIControl {
} }
} }
/// Handles the TouchUpInside event.
internal func handleTouchUpInside() {
toggle()
}
/** /**
Handle the TouchDragInside event. Handle the TouchDragInside event.
- Parameter sender: A UIButton. - Parameter sender: A UIButton.
- Parameter event: A UIEvent. - Parameter event: A UIEvent.
*/ */
@objc(handleTouchDragInside:event:)
internal func handleTouchDragInside(sender: FabButton, event: UIEvent) { internal func handleTouchDragInside(sender: FabButton, event: UIEvent) {
if let v = event.touchesForView(sender)?.first { if let v = event.touchesForView(sender)?.first {
let q: CGFloat = max(min(sender.x + v.locationInView(sender).x - v.previousLocationInView(sender).x, onPosition), offPosition) let q: CGFloat = max(min(sender.x + v.locationInView(sender).x - v.previousLocationInView(sender).x, onPosition), offPosition)
...@@ -383,10 +385,10 @@ public class MaterialSwitch : UIControl { ...@@ -383,10 +385,10 @@ public class MaterialSwitch : UIControl {
/// Prepares the button. /// Prepares the button.
private func prepareButton() { private func prepareButton() {
button.pulseColor = nil button.pulseColor = nil
button.addTarget(self, action: "handleTouchUpOutsideOrCanceled:event:", forControlEvents: .TouchUpOutside) button.addTarget(self, action: #selector(handleTouchUpInside), forControlEvents: .TouchUpInside)
button.addTarget(self, action: "handleTouchUpInside", forControlEvents: .TouchUpInside) button.addTarget(self, action: #selector(handleTouchDragInside(_: _:), forControlEvents: .TouchDragInside)
button.addTarget(self, action: "handleTouchDragInside:event:", forControlEvents: .TouchDragInside) button.addTarget(self, action: #selector(handleTouchUpOutsideOrCanceled(_: _:)), forControlEvents: .TouchCancel)
button.addTarget(self, action: "handleTouchUpOutsideOrCanceled:event:", forControlEvents: .TouchCancel) button.addTarget(self, action: #selector(handleTouchUpOutsideOrCanceled(_: _:)), forControlEvents: .TouchUpOutside)
addSubview(button) addSubview(button)
} }
......
...@@ -166,7 +166,7 @@ public class Menu { ...@@ -166,7 +166,7 @@ public class Menu {
private func openUpAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) { private func openUpAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIView> = views { if let v: Array<UIView> = views {
var base: UIView? var base: UIView?
for var i: Int = 1, l: Int = v.count; i < l; ++i { for i in 1..<v.count {
if nil == base { if nil == base {
base = v[0] base = v[0]
} }
...@@ -203,7 +203,7 @@ public class Menu { ...@@ -203,7 +203,7 @@ public class Menu {
*/ */
public func closeUpAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) { public func closeUpAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIView> = views { if let v: Array<UIView> = views {
for var i: Int = 1, l: Int = v.count; i < l; ++i { for i in 1..<v.count {
let view: UIView = v[i] let view: UIView = v[i]
UIView.animateWithDuration(Double(i) * duration, UIView.animateWithDuration(Double(i) * duration,
...@@ -238,7 +238,7 @@ public class Menu { ...@@ -238,7 +238,7 @@ public class Menu {
private func openDownAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) { private func openDownAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIView> = views { if let v: Array<UIView> = views {
var base: UIView? var base: UIView?
for var i: Int = 1, l: Int = v.count; i < l; ++i { for i in 1..<v.count {
if nil == base { if nil == base {
base = v[0] base = v[0]
} }
...@@ -277,7 +277,7 @@ public class Menu { ...@@ -277,7 +277,7 @@ public class Menu {
*/ */
public func closeDownAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) { public func closeDownAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIView> = views { if let v: Array<UIView> = views {
for var i: Int = 1, l: Int = v.count; i < l; ++i { for i in 1..<v.count {
let view: UIView = v[i] let view: UIView = v[i]
let h: CGFloat = nil == baseViewSize ? itemViewSize.height : baseViewSize!.height let h: CGFloat = nil == baseViewSize ? itemViewSize.height : baseViewSize!.height
...@@ -313,7 +313,7 @@ public class Menu { ...@@ -313,7 +313,7 @@ public class Menu {
private func openLeftAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) { private func openLeftAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIView> = views { if let v: Array<UIView> = views {
var base: UIView? var base: UIView?
for var i: Int = 1, l: Int = v.count; i < l; ++i { for i in 1..<v.count {
if nil == base { if nil == base {
base = v[0] base = v[0]
} }
...@@ -351,7 +351,7 @@ public class Menu { ...@@ -351,7 +351,7 @@ public class Menu {
*/ */
public func closeLeftAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) { public func closeLeftAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIView> = views { if let v: Array<UIView> = views {
for var i: Int = 1, l: Int = v.count; i < l; ++i { for i in 1..<v.count {
let view: UIView = v[i] let view: UIView = v[i]
UIView.animateWithDuration(Double(i) * duration, UIView.animateWithDuration(Double(i) * duration,
delay: delay, delay: delay,
...@@ -385,7 +385,7 @@ public class Menu { ...@@ -385,7 +385,7 @@ public class Menu {
private func openRightAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) { private func openRightAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIView> = views { if let v: Array<UIView> = views {
var base: UIView? var base: UIView?
for var i: Int = 1, l: Int = v.count; i < l; ++i { for i in 1..<v.count {
if nil == base { if nil == base {
base = v[0] base = v[0]
} }
...@@ -423,7 +423,7 @@ public class Menu { ...@@ -423,7 +423,7 @@ public class Menu {
*/ */
public func closeRightAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) { public func closeRightAnimation(duration: NSTimeInterval, delay: NSTimeInterval, usingSpringWithDamping: CGFloat, initialSpringVelocity: CGFloat, options: UIViewAnimationOptions, animations: ((UIView) -> Void)?, completion: ((UIView) -> Void)?) {
if let v: Array<UIView> = views { if let v: Array<UIView> = views {
for var i: Int = 1, l: Int = v.count; i < l; ++i { for i in 1..<v.count {
let view: UIView = v[i] let view: UIView = v[i]
let w: CGFloat = nil == baseViewSize ? itemViewSize.width : baseViewSize!.width let w: CGFloat = nil == baseViewSize ? itemViewSize.width : baseViewSize!.width
...@@ -450,7 +450,7 @@ public class Menu { ...@@ -450,7 +450,7 @@ public class Menu {
private func layoutButtons() { private func layoutButtons() {
if let v: Array<UIView> = views { if let v: Array<UIView> = views {
let size: CGSize = nil == baseViewSize ? itemViewSize : baseViewSize! let size: CGSize = nil == baseViewSize ? itemViewSize : baseViewSize!
for var i: Int = 0, l: Int = v.count; i < l; ++i { for i in 0..<v.count {
let view: UIView = v[i] let view: UIView = v[i]
if 0 == i { if 0 == i {
view.frame.size = size view.frame.size = size
......
...@@ -115,8 +115,8 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD ...@@ -115,8 +115,8 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
} else { } else {
item.leftControls = [v.backButton] item.leftControls = [v.backButton]
} }
v.backButton.removeTarget(self, action: "handleBackButton", forControlEvents: .TouchUpInside) v.backButton.removeTarget(self, action: #selector(handleBackButton), forControlEvents: .TouchUpInside)
v.backButton.addTarget(self, action: "handleBackButton", forControlEvents: .TouchUpInside) v.backButton.addTarget(self, action: #selector(handleBackButton), forControlEvents: .TouchUpInside)
v.layoutNavigationItem(item) v.layoutNavigationItem(item)
} }
return true return true
......
...@@ -615,6 +615,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -615,6 +615,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
- Parameter recognizer: A UIPanGestureRecognizer that is - Parameter recognizer: A UIPanGestureRecognizer that is
passed to the handler when recognized. passed to the handler when recognized.
*/ */
@objc(handlePanGesture:)
internal func handlePanGesture(recognizer: UIPanGestureRecognizer) { internal func handlePanGesture(recognizer: UIPanGestureRecognizer) {
// Deterine which view to pan. // Deterine which view to pan.
if enabledRightView && (openedRightView || !openedLeftView && isPointContainedWithinRightViewThreshold(recognizer.locationInView(view))) { if enabledRightView && (openedRightView || !openedLeftView && isPointContainedWithinRightViewThreshold(recognizer.locationInView(view))) {
...@@ -700,6 +701,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -700,6 +701,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
- Parameter recognizer: A UITapGestureRecognizer that is - Parameter recognizer: A UITapGestureRecognizer that is
passed to the handler when recognized. passed to the handler when recognized.
*/ */
@objc(handleTapGesture:)
internal func handleTapGesture(recognizer: UITapGestureRecognizer) { internal func handleTapGesture(recognizer: UITapGestureRecognizer) {
if openedLeftView { if openedLeftView {
if let v: MaterialView = leftView { if let v: MaterialView = leftView {
...@@ -807,13 +809,13 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -807,13 +809,13 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
*/ */
private func prepareGestures() { private func prepareGestures() {
if nil == panGesture { if nil == panGesture {
panGesture = UIPanGestureRecognizer(target: self, action: "handlePanGesture:") panGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture(_:)))
panGesture!.delegate = self panGesture!.delegate = self
view.addGestureRecognizer(panGesture!) view.addGestureRecognizer(panGesture!)
} }
if nil == tapGesture { if nil == tapGesture {
tapGesture = UITapGestureRecognizer(target: self, action: "handleTapGesture:") tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTapGesture(_:)))
tapGesture!.delegate = self tapGesture!.delegate = self
tapGesture!.cancelsTouchesInView = false tapGesture!.cancelsTouchesInView = false
view.addGestureRecognizer(tapGesture!) view.addGestureRecognizer(tapGesture!)
......
...@@ -282,7 +282,7 @@ public class TextField : UITextField { ...@@ -282,7 +282,7 @@ public class TextField : UITextField {
clearButtonMode = .Never clearButtonMode = .Never
rightViewMode = .WhileEditing rightViewMode = .WhileEditing
v.contentEdgeInsets = UIEdgeInsetsZero v.contentEdgeInsets = UIEdgeInsetsZero
v.addTarget(self, action: "handleClearButton", forControlEvents: .TouchUpInside) v.addTarget(self, action: #selector(handleClearButton), forControlEvents: .TouchUpInside)
} else { } else {
clearButtonMode = .WhileEditing clearButtonMode = .WhileEditing
rightViewMode = .Never rightViewMode = .Never
...@@ -681,9 +681,9 @@ public class TextField : UITextField { ...@@ -681,9 +681,9 @@ public class TextField : UITextField {
} else { } else {
v.alpha = 0 v.alpha = 0
} }
addTarget(self, action: "textFieldDidBegin", forControlEvents: .EditingDidBegin) addTarget(self, action: #selector(textFieldDidBegin), forControlEvents: .EditingDidBegin)
addTarget(self, action: "textFieldDidChange", forControlEvents: .EditingChanged) addTarget(self, action: #selector(textFieldDidChange), forControlEvents: .EditingChanged)
addTarget(self, action: "textFieldDidEnd", forControlEvents: .EditingDidEnd) addTarget(self, action: #selector(textFieldDidEnd), forControlEvents: .EditingDidEnd)
} }
} }
...@@ -698,11 +698,11 @@ public class TextField : UITextField { ...@@ -698,11 +698,11 @@ public class TextField : UITextField {
showDetailLabel() showDetailLabel()
} }
if nil == titleLabel { if nil == titleLabel {
addTarget(self, action: "textFieldDidBegin", forControlEvents: .EditingDidBegin) addTarget(self, action: #selector(textFieldDidBegin), forControlEvents: .EditingDidBegin)
addTarget(self, action: "textFieldDidChange", forControlEvents: .EditingChanged) addTarget(self, action: #selector(textFieldDidChange), forControlEvents: .EditingChanged)
addTarget(self, action: "textFieldDidEnd", forControlEvents: .EditingDidEnd) addTarget(self, action: #selector(textFieldDidEnd), forControlEvents: .EditingDidEnd)
} }
addTarget(self, action: "textFieldValueChanged", forControlEvents: .ValueChanged) addTarget(self, action: #selector(textFieldValueChanged), forControlEvents: .ValueChanged)
} }
} }
......
...@@ -589,9 +589,9 @@ public class TextView: UITextView { ...@@ -589,9 +589,9 @@ public class TextView: UITextView {
/// Prepares the Notification handlers. /// Prepares the Notification handlers.
private func prepareNotificationHandlers() { private func prepareNotificationHandlers() {
NSNotificationCenter.defaultCenter().addObserver(self, selector: "handleTextViewTextDidBegin", name: UITextViewTextDidBeginEditingNotification, object: nil) NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(handleTextViewTextDidBegin), name: UITextViewTextDidBeginEditingNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "handleTextViewTextDidChange", name: UITextViewTextDidChangeNotification, object: nil) NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(handleTextViewTextDidChange), name: UITextViewTextDidChangeNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "handleTextViewTextDidEnd", name: UITextViewTextDidEndEditingNotification, object: nil) NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(handleTextViewTextDidEnd), name: UITextViewTextDidEndEditingNotification, object: nil)
} }
/// Removes the Notification handlers. /// Removes the Notification handlers.
......
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