Commit c73bd151 by Daniel Dahan

updated SideNavigationController internals to better handle panning and to…

updated SideNavigationController internals to better handle panning and to remove gestures when not enabled
parent 657394ba
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
96162C6C1CA71C8700E3A235 /* VideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C6B1CA71C8700E3A235 /* VideoViewController.swift */; }; 96162C6C1CA71C8700E3A235 /* VideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C6B1CA71C8700E3A235 /* VideoViewController.swift */; };
96162C6E1CA7274E00E3A235 /* PhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */; }; 96162C6E1CA7274E00E3A235 /* PhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */; };
9658F20E1CD6C77D00B902C1 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F20D1CD6C77D00B902C1 /* Material.framework */; };
9658F20F1CD6C77D00B902C1 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F20D1CD6C77D00B902C1 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
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 */; };
...@@ -30,7 +28,6 @@ ...@@ -30,7 +28,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
9658F20F1CD6C77D00B902C1 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -40,7 +37,6 @@ ...@@ -40,7 +37,6 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
96162C6B1CA71C8700E3A235 /* VideoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoViewController.swift; sourceTree = "<group>"; }; 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>"; }; 96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoViewController.swift; sourceTree = "<group>"; };
9658F20D1CD6C77D00B902C1 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphonesimulator/Material.framework"; sourceTree = "<absolute>"; };
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>"; };
...@@ -60,7 +56,6 @@ ...@@ -60,7 +56,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9658F20E1CD6C77D00B902C1 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -70,7 +65,6 @@ ...@@ -70,7 +65,6 @@
9663F9251C7A744500AF0965 = { 9663F9251C7A744500AF0965 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9658F20D1CD6C77D00B902C1 /* Material.framework */,
9663F9301C7A744600AF0965 /* App */, 9663F9301C7A744600AF0965 /* App */,
9663F92F1C7A744600AF0965 /* Products */, 9663F92F1C7A744600AF0965 /* Products */,
); );
......
...@@ -41,27 +41,21 @@ class AppNavigationController: NavigationController { ...@@ -41,27 +41,21 @@ class AppNavigationController: NavigationController {
prepareNavigationBar() prepareNavigationBar()
} }
/**
Uncomment the code to set a statusBar that is colored, different
from the NavigationBar. Note, if using the .CenterRadialBeyondBounds
pulseAnimation value, it will cover the animation radial effect.
*/
override func viewWillLayoutSubviews() { override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews() super.viewWillLayoutSubviews()
// statusBarView?.hidden = MaterialDevice.statusBarHidden statusBarView?.hidden = MaterialDevice.statusBarHidden
} }
/// Prepares the statusBarView /// Prepares the statusBarView
private func prepareStatusBarView() { private func prepareStatusBarView() {
// statusBarView = MaterialView() statusBarView = MaterialView()
// statusBarView!.backgroundColor = MaterialColor.blue.darken2 statusBarView!.backgroundColor = MaterialColor.blue.darken2
// view.addSubview(statusBarView!) view.addSubview(statusBarView!)
// statusBarView!.translatesAutoresizingMaskIntoConstraints = false statusBarView!.translatesAutoresizingMaskIntoConstraints = false
// MaterialLayout.alignFromTop(view, child: statusBarView!) MaterialLayout.alignFromTop(view, child: statusBarView!)
// MaterialLayout.alignToParentHorizontally(view, child: statusBarView!) MaterialLayout.alignToParentHorizontally(view, child: statusBarView!)
// MaterialLayout.height(view, child: statusBarView!, height: 20) MaterialLayout.height(view, child: statusBarView!, height: 20)
} }
/// Prepares the navigationBar /// Prepares the navigationBar
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
9658F2111CD6CDD700B902C1 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F2101CD6CDD700B902C1 /* Material.framework */; };
9658F2121CD6CDD700B902C1 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F2101CD6CDD700B902C1 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96DB1C5F1C14AA2800825BE6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96DB1C5E1C14AA2800825BE6 /* AppDelegate.swift */; }; 96DB1C5F1C14AA2800825BE6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96DB1C5E1C14AA2800825BE6 /* AppDelegate.swift */; };
96DB1C611C14AA2800825BE6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96DB1C601C14AA2800825BE6 /* ViewController.swift */; }; 96DB1C611C14AA2800825BE6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96DB1C601C14AA2800825BE6 /* ViewController.swift */; };
96DB1C661C14AA2800825BE6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96DB1C651C14AA2800825BE6 /* Assets.xcassets */; }; 96DB1C661C14AA2800825BE6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96DB1C651C14AA2800825BE6 /* Assets.xcassets */; };
...@@ -22,7 +20,6 @@ ...@@ -22,7 +20,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
9658F2121CD6CDD700B902C1 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -30,7 +27,6 @@ ...@@ -30,7 +27,6 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
9658F2101CD6CDD700B902C1 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphonesimulator/Material.framework"; sourceTree = "<absolute>"; };
96DB1C5B1C14AA2800825BE6 /* MaterialPulseView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MaterialPulseView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 96DB1C5B1C14AA2800825BE6 /* MaterialPulseView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MaterialPulseView.app; sourceTree = BUILT_PRODUCTS_DIR; };
96DB1C5E1C14AA2800825BE6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 96DB1C5E1C14AA2800825BE6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96DB1C601C14AA2800825BE6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; 96DB1C601C14AA2800825BE6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
...@@ -44,7 +40,6 @@ ...@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9658F2111CD6CDD700B902C1 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -54,7 +49,6 @@ ...@@ -54,7 +49,6 @@
96DB1C521C14AA2800825BE6 = { 96DB1C521C14AA2800825BE6 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9658F2101CD6CDD700B902C1 /* Material.framework */,
96DB1C5D1C14AA2800825BE6 /* MaterialPulseView */, 96DB1C5D1C14AA2800825BE6 /* MaterialPulseView */,
96DB1C5C1C14AA2800825BE6 /* Products */, 96DB1C5C1C14AA2800825BE6 /* Products */,
); );
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
9658F21F1CD7ACD600B902C1 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F21E1CD7ACD600B902C1 /* Material.framework */; };
9658F2201CD7ACD600B902C1 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F21E1CD7ACD600B902C1 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96E5E4671CC1E5EC0054837B /* PurpleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E5E4661CC1E5EC0054837B /* PurpleViewController.swift */; }; 96E5E4671CC1E5EC0054837B /* PurpleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E5E4661CC1E5EC0054837B /* PurpleViewController.swift */; };
96E5E4691CC1E6130054837B /* OrangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E5E4681CC1E6130054837B /* OrangeViewController.swift */; }; 96E5E4691CC1E6130054837B /* OrangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E5E4681CC1E6130054837B /* OrangeViewController.swift */; };
96E5E46B1CC1E8FB0054837B /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E5E46A1CC1E8FB0054837B /* AppLeftViewController.swift */; }; 96E5E46B1CC1E8FB0054837B /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E5E46A1CC1E8FB0054837B /* AppLeftViewController.swift */; };
...@@ -25,6 +27,7 @@ ...@@ -25,6 +27,7 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
9658F2201CD7ACD600B902C1 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -32,6 +35,7 @@ ...@@ -32,6 +35,7 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
9658F21E1CD7ACD600B902C1 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
9663F9651C7ADCB600AF0965 /* SideNavigationController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SideNavigationController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9663F9651C7ADCB600AF0965 /* SideNavigationController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SideNavigationController.app; sourceTree = BUILT_PRODUCTS_DIR; };
96E5E4661CC1E5EC0054837B /* PurpleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PurpleViewController.swift; sourceTree = "<group>"; }; 96E5E4661CC1E5EC0054837B /* PurpleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PurpleViewController.swift; sourceTree = "<group>"; };
96E5E4681CC1E6130054837B /* OrangeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrangeViewController.swift; sourceTree = "<group>"; }; 96E5E4681CC1E6130054837B /* OrangeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrangeViewController.swift; sourceTree = "<group>"; };
...@@ -50,6 +54,7 @@ ...@@ -50,6 +54,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9658F21F1CD7ACD600B902C1 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -59,6 +64,7 @@ ...@@ -59,6 +64,7 @@
9663F95C1C7ADCB600AF0965 = { 9663F95C1C7ADCB600AF0965 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9658F21E1CD7ACD600B902C1 /* Material.framework */,
96F2F1FC1C97A68800A5FE27 /* SideNavigationController */, 96F2F1FC1C97A68800A5FE27 /* SideNavigationController */,
9663F9661C7ADCB600AF0965 /* Products */, 9663F9661C7ADCB600AF0965 /* Products */,
); );
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
9658F2141CD6D82000B902C1 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F2131CD6D82000B902C1 /* Material.framework */; };
9658F2151CD6D82000B902C1 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9658F2131CD6D82000B902C1 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
966F57A11C226BAA009185B7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966F57A01C226BAA009185B7 /* AppDelegate.swift */; }; 966F57A11C226BAA009185B7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966F57A01C226BAA009185B7 /* AppDelegate.swift */; };
966F57A31C226BAA009185B7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966F57A21C226BAA009185B7 /* ViewController.swift */; }; 966F57A31C226BAA009185B7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 966F57A21C226BAA009185B7 /* ViewController.swift */; };
966F57A81C226BAA009185B7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 966F57A71C226BAA009185B7 /* Assets.xcassets */; }; 966F57A81C226BAA009185B7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 966F57A71C226BAA009185B7 /* Assets.xcassets */; };
...@@ -22,7 +20,6 @@ ...@@ -22,7 +20,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
9658F2151CD6D82000B902C1 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -30,7 +27,6 @@ ...@@ -30,7 +27,6 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
9658F2131CD6D82000B902C1 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphonesimulator/Material.framework"; sourceTree = "<absolute>"; };
966F579D1C226BAA009185B7 /* TextField.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TextField.app; sourceTree = BUILT_PRODUCTS_DIR; }; 966F579D1C226BAA009185B7 /* TextField.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TextField.app; sourceTree = BUILT_PRODUCTS_DIR; };
966F57A01C226BAA009185B7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 966F57A01C226BAA009185B7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
966F57A21C226BAA009185B7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; 966F57A21C226BAA009185B7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
...@@ -44,7 +40,6 @@ ...@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9658F2141CD6D82000B902C1 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -54,7 +49,6 @@ ...@@ -54,7 +49,6 @@
966F57941C226BAA009185B7 = { 966F57941C226BAA009185B7 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9658F2131CD6D82000B902C1 /* Material.framework */,
966F579F1C226BAA009185B7 /* TextField */, 966F579F1C226BAA009185B7 /* TextField */,
966F579E1C226BAA009185B7 /* Products */, 966F579E1C226BAA009185B7 /* Products */,
); );
......
...@@ -410,9 +410,7 @@ public class MaterialButton : UIButton { ...@@ -410,9 +410,7 @@ public class MaterialButton : UIButton {
*/ */
public func pulse(point: CGPoint? = nil) { public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point!
if let color: UIColor = pulseColor { MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
MaterialAnimation.delay(0.35) { [weak self] in MaterialAnimation.delay(0.35) { [weak self] in
if let s: MaterialButton = self { if let s: MaterialButton = self {
MaterialAnimation.pulseContractAnimation(s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation) MaterialAnimation.pulseContractAnimation(s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
......
...@@ -515,9 +515,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -515,9 +515,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
*/ */
public func pulse(point: CGPoint? = nil) { public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point!
if let color: UIColor = pulseColor { MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
MaterialAnimation.delay(0.35) { [weak self] in MaterialAnimation.delay(0.35) { [weak self] in
if let s: MaterialCollectionViewCell = self { if let s: MaterialCollectionViewCell = self {
MaterialAnimation.pulseContractAnimation(s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation) MaterialAnimation.pulseContractAnimation(s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
......
...@@ -57,9 +57,7 @@ public class MaterialPulseView : MaterialView { ...@@ -57,9 +57,7 @@ public class MaterialPulseView : MaterialView {
*/ */
public func pulse(point: CGPoint? = nil) { public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point!
if let color: UIColor = pulseColor { MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
MaterialAnimation.delay(0.35) { [weak self] in MaterialAnimation.delay(0.35) { [weak self] in
if let s: MaterialPulseView = self { if let s: MaterialPulseView = self {
MaterialAnimation.pulseContractAnimation(s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation) MaterialAnimation.pulseContractAnimation(s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
......
...@@ -365,9 +365,7 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -365,9 +365,7 @@ public class MaterialTableViewCell : UITableViewCell {
*/ */
public func pulse(point: CGPoint? = nil) { public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPointMake(CGFloat(width / 2), CGFloat(height / 2)) : point!
if let color: UIColor = pulseColor { MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
MaterialAnimation.pulseExpandAnimation(layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
}
MaterialAnimation.delay(0.35) { [weak self] in MaterialAnimation.delay(0.35) { [weak self] in
if let s: MaterialTableViewCell = self { if let s: MaterialTableViewCell = self {
MaterialAnimation.pulseContractAnimation(s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation) MaterialAnimation.pulseContractAnimation(s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
......
...@@ -73,8 +73,11 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD ...@@ -73,8 +73,11 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
super.viewWillAppear(animated) super.viewWillAppear(animated)
if let v: UIGestureRecognizer = interactivePopGestureRecognizer { if let v: UIGestureRecognizer = interactivePopGestureRecognizer {
if let x: SideNavigationController = sideNavigationController { if let x: SideNavigationController = sideNavigationController {
if let p: UIPanGestureRecognizer = x.panGesture { if let l: UIPanGestureRecognizer = x.panLeftViewGesture {
p.requireGestureRecognizerToFail(v) l.requireGestureRecognizerToFail(v)
}
if let r: UIPanGestureRecognizer = x.panRightViewGesture {
r.requireGestureRecognizerToFail(v)
} }
} }
} }
......
...@@ -125,15 +125,27 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -125,15 +125,27 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
/** /**
A UIPanGestureRecognizer property internally used for the A UIPanGestureRecognizer property internally used for the
pan gesture. leftView pan gesture.
*/ */
internal private(set) var panGesture: UIPanGestureRecognizer? internal private(set) var panLeftViewGesture: UIPanGestureRecognizer?
/**
A UIPanGestureRecognizer property internally used for the
rightView pan gesture.
*/
internal private(set) var panRightViewGesture: UIPanGestureRecognizer?
/** /**
A UITapGestureRecognizer property internally used for the A UITapGestureRecognizer property internally used for the
tap gesture. leftView tap gesture.
*/
internal private(set) var tapLeftViewGesture: UITapGestureRecognizer?
/**
A UITapGestureRecognizer property internally used for the
rightView tap gesture.
*/ */
internal private(set) var tapGesture: UITapGestureRecognizer? internal private(set) var tapRightViewGesture: UITapGestureRecognizer?
/** /**
A CGFloat property that accesses the leftView threshold of A CGFloat property that accesses the leftView threshold of
...@@ -143,7 +155,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -143,7 +155,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
leftView is closed. The leftViewThreshold is always at half leftView is closed. The leftViewThreshold is always at half
the width of the leftView. the width of the leftView.
*/ */
@IBInspectable public var leftThreshold: CGFloat? @IBInspectable public var leftThreshold: CGFloat = 32
private var leftViewThreshold: CGFloat = 0 private var leftViewThreshold: CGFloat = 0
/** /**
...@@ -154,7 +166,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -154,7 +166,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
rightView is opened. The rightViewThreshold is always at half rightView is opened. The rightViewThreshold is always at half
the width of the rightView. the width of the rightView.
*/ */
@IBInspectable public var rightThreshold: CGFloat? @IBInspectable public var rightThreshold: CGFloat = 32
private var rightViewThreshold: CGFloat = 0 private var rightViewThreshold: CGFloat = 0
/// Sets the animation type for the statusBar when hiding. /// Sets the animation type for the statusBar when hiding.
...@@ -210,13 +222,29 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -210,13 +222,29 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
A Boolean property that enables and disables the leftView from A Boolean property that enables and disables the leftView from
opening and closing. Defaults to true. opening and closing. Defaults to true.
*/ */
@IBInspectable public var enabledLeftView: Bool = true @IBInspectable public var enabledLeftView: Bool = true {
didSet {
if enabledLeftView {
prepareLeftViewGestures()
} else {
removeLeftViewGestures()
}
}
}
/** /**
A Boolean property that enables and disables the rightView from A Boolean property that enables and disables the rightView from
opening and closing. Defaults to true. opening and closing. Defaults to true.
*/ */
@IBInspectable public var enabledRightView: Bool = true @IBInspectable public var enabledRightView: Bool = true {
didSet {
if enabledRightView {
prepareRightViewGestures()
} else {
removeRightViewGestures()
}
}
}
/** /**
A Boolean property that triggers the status bar to be hidden A Boolean property that triggers the status bar to be hidden
...@@ -540,7 +568,6 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -540,7 +568,6 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
if let v: MaterialView = leftView { if let v: MaterialView = leftView {
hideStatusBar() hideStatusBar()
showView(v) showView(v)
delegate?.sideNavigationWillOpen?(self, position: .Left) delegate?.sideNavigationWillOpen?(self, position: .Left)
rootViewController.view.alpha = 0.5 rootViewController.view.alpha = 0.5
UIView.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.x / velocity)))), UIView.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.x / velocity)))),
...@@ -564,7 +591,6 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -564,7 +591,6 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
if let v: MaterialView = rightView { if let v: MaterialView = rightView {
hideStatusBar() hideStatusBar()
showView(v) showView(v)
delegate?.sideNavigationWillOpen?(self, position: .Right) delegate?.sideNavigationWillOpen?(self, position: .Right)
rootViewController.view.alpha = 0.5 rootViewController.view.alpha = 0.5
UIView.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.x / velocity)))), UIView.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.x / velocity)))),
...@@ -586,6 +612,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -586,6 +612,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
public func closeLeftView(velocity: CGFloat = 0) { public func closeLeftView(velocity: CGFloat = 0) {
if enabledLeftView { if enabledLeftView {
if let v: MaterialView = leftView { if let v: MaterialView = leftView {
showStatusBar()
delegate?.sideNavigationWillClose?(self, position: .Left) delegate?.sideNavigationWillClose?(self, position: .Left)
rootViewController.view.alpha = 1 rootViewController.view.alpha = 1
UIView.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.x / velocity)))), UIView.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.x / velocity)))),
...@@ -593,7 +620,6 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -593,7 +620,6 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
v.position.x = -v.width / 2 v.position.x = -v.width / 2
}) { [unowned self] _ in }) { [unowned self] _ in
self.hideView(v) self.hideView(v)
self.toggleStatusBar()
self.delegate?.sideNavigationDidClose?(self, position: .Left) self.delegate?.sideNavigationDidClose?(self, position: .Left)
} }
} }
...@@ -609,6 +635,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -609,6 +635,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
public func closeRightView(velocity: CGFloat = 0) { public func closeRightView(velocity: CGFloat = 0) {
if enabledRightView { if enabledRightView {
if let v: MaterialView = rightView { if let v: MaterialView = rightView {
showStatusBar()
delegate?.sideNavigationWillClose?(self, position: .Right) delegate?.sideNavigationWillClose?(self, position: .Right)
rootViewController.view.alpha = 1 rootViewController.view.alpha = 1
UIView.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.x / velocity)))), UIView.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(v.x / velocity)))),
...@@ -616,7 +643,6 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -616,7 +643,6 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
v.position.x = self.view.bounds.width + v.width / 2 v.position.x = self.view.bounds.width + v.width / 2
}) { [unowned self] _ in }) { [unowned self] _ in
self.hideView(v) self.hideView(v)
self.toggleStatusBar()
self.delegate?.sideNavigationDidClose?(self, position: .Right) self.delegate?.sideNavigationDidClose?(self, position: .Right)
} }
} }
...@@ -630,91 +656,110 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -630,91 +656,110 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
- Returns: A Boolean of whether to continue the gesture or not. - Returns: A Boolean of whether to continue the gesture or not.
*/ */
public func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool { public func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool {
if gestureRecognizer == panGesture { if !openedRightView && gestureRecognizer == panLeftViewGesture && (openedLeftView || isPointContainedWithinLeftThreshold(touch.locationInView(view))) {
return opened || isPointContainedWithinLeftViewThreshold(touch.locationInView(view)) || isPointContainedWithinRightViewThreshold(touch.locationInView(view)) return true
}
if !openedLeftView && gestureRecognizer == panRightViewGesture && (openedRightView || isPointContainedWithinRighThreshold(touch.locationInView(view))) {
return true
} }
return opened && gestureRecognizer == tapGesture if openedLeftView && gestureRecognizer == tapLeftViewGesture {
return true
}
if openedRightView && gestureRecognizer == tapRightViewGesture {
return true
}
return false
} }
/** /**
A method that is fired when the pan gesture is recognized A method that is fired when the pan gesture is recognized
for the SideNavigationController. for the leftView.
- 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 handleLeftViewPanGesture(recognizer: UIPanGestureRecognizer) {
internal func handlePanGesture(recognizer: UIPanGestureRecognizer) { if enabledLeftView && (openedLeftView || !openedRightView && isPointContainedWithinLeftThreshold(recognizer.locationInView(view))) {
// Deterine which view to pan. if let v: MaterialView = leftView {
if enabledRightView && (openedRightView || !openedLeftView && isPointContainedWithinRightViewThreshold(recognizer.locationInView(view))) {
if let v: MaterialView = rightView {
let point: CGPoint = recognizer.locationInView(view) let point: CGPoint = recognizer.locationInView(view)
// Animate the panel. // Animate the panel.
switch recognizer.state { switch recognizer.state {
case .Began: case .Began:
originalX = v.position.x originalX = v.position.x
hideStatusBar()
showView(v) showView(v)
delegate?.sideNavigationPanDidBegin?(self, point: point, position: .Left)
delegate?.sideNavigationPanDidBegin?(self, point: point, position: .Right)
case .Changed: case .Changed:
let w: CGFloat = v.width let w: CGFloat = v.width
let translationX: CGFloat = recognizer.translationInView(v).x let translationX: CGFloat = recognizer.translationInView(v).x
v.position.x = originalX + translationX < view.bounds.width - (w / 2) ? view.bounds.width - (w / 2) : originalX + translationX v.position.x = originalX + translationX > (w / 2) ? (w / 2) : originalX + translationX
let a: CGFloat = 1 - (view.bounds.width - v.position.x) / v.width let a: CGFloat = 1 - v.position.x / v.width
rootViewController.view.alpha = 0.5 < a ? a : 0.5 rootViewController.view.alpha = 0.5 < a ? a : 0.5
delegate?.sideNavigationPanDidChange?(self, point: point, position: .Right) if v.position.x >= leftThreshold {
hideStatusBar()
}
delegate?.sideNavigationPanDidChange?(self, point: point, position: .Left)
case .Ended, .Cancelled, .Failed: case .Ended, .Cancelled, .Failed:
let p: CGPoint = recognizer.velocityInView(recognizer.view) let p: CGPoint = recognizer.velocityInView(recognizer.view)
let x: CGFloat = p.x >= 1000 || p.x <= -1000 ? p.x : 0 let x: CGFloat = p.x >= 1000 || p.x <= -1000 ? p.x : 0
delegate?.sideNavigationPanDidEnd?(self, point: point, position: .Right) delegate?.sideNavigationPanDidEnd?(self, point: point, position: .Left)
if v.x >= rightViewThreshold || x > 1000 { if v.x <= -leftViewWidth + leftViewThreshold || x < -1000 {
closeRightView(x) closeLeftView(x)
} else { } else {
openRightView(x) openLeftView(x)
} }
case .Possible:break case .Possible:break
} }
} }
} else if enabledLeftView && (openedLeftView || !openedRightView && isPointContainedWithinLeftViewThreshold(recognizer.locationInView(view))) { }
if let v: MaterialView = leftView { }
/**
A method that is fired when the pan gesture is recognized
for the rightView.
- Parameter recognizer: A UIPanGestureRecognizer that is
passed to the handler when recognized.
*/
internal func handleRightViewPanGesture(recognizer: UIPanGestureRecognizer) {
if enabledRightView && (openedRightView || !openedLeftView && isPointContainedWithinRighThreshold(recognizer.locationInView(view))) {
if let v: MaterialView = rightView {
let point: CGPoint = recognizer.locationInView(view) let point: CGPoint = recognizer.locationInView(view)
// Animate the panel. // Animate the panel.
switch recognizer.state { switch recognizer.state {
case .Began: case .Began:
originalX = v.position.x originalX = v.position.x
hideStatusBar()
showView(v) showView(v)
delegate?.sideNavigationPanDidBegin?(self, point: point, position: .Right)
delegate?.sideNavigationPanDidBegin?(self, point: point, position: .Left)
case .Changed: case .Changed:
let w: CGFloat = v.width let w: CGFloat = v.width
let translationX: CGFloat = recognizer.translationInView(v).x let translationX: CGFloat = recognizer.translationInView(v).x
v.position.x = originalX + translationX > (w / 2) ? (w / 2) : originalX + translationX v.position.x = originalX + translationX < view.bounds.width - (w / 2) ? view.bounds.width - (w / 2) : originalX + translationX
let a: CGFloat = 1 - v.position.x / v.width let a: CGFloat = 1 - (view.bounds.width - v.position.x) / v.width
rootViewController.view.alpha = 0.5 < a ? a : 0.5 rootViewController.view.alpha = 0.5 < a ? a : 0.5
delegate?.sideNavigationPanDidChange?(self, point: point, position: .Left) if v.position.x <= view.bounds.width - rightThreshold {
hideStatusBar()
}
delegate?.sideNavigationPanDidChange?(self, point: point, position: .Right)
case .Ended, .Cancelled, .Failed: case .Ended, .Cancelled, .Failed:
let p: CGPoint = recognizer.velocityInView(recognizer.view) let p: CGPoint = recognizer.velocityInView(recognizer.view)
let x: CGFloat = p.x >= 1000 || p.x <= -1000 ? p.x : 0 let x: CGFloat = p.x >= 1000 || p.x <= -1000 ? p.x : 0
delegate?.sideNavigationPanDidEnd?(self, point: point, position: .Left) delegate?.sideNavigationPanDidEnd?(self, point: point, position: .Right)
if v.x <= -leftViewWidth + leftViewThreshold || x < -1000 { if v.x >= rightViewThreshold || x > 1000 {
closeLeftView(x) closeRightView(x)
} else { } else {
openLeftView(x) openRightView(x)
} }
case .Possible:break case .Possible:break
} }
...@@ -724,12 +769,11 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -724,12 +769,11 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
/** /**
A method that is fired when the tap gesture is recognized A method that is fired when the tap gesture is recognized
for the SideNavigationController. for the leftView.
- 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 handleLeftViewTapGesture(recognizer: UITapGestureRecognizer) {
internal func handleTapGesture(recognizer: UITapGestureRecognizer) {
if openedLeftView { if openedLeftView {
if let v: MaterialView = leftView { if let v: MaterialView = leftView {
delegate?.sideNavigationDidTap?(self, point: recognizer.locationInView(view), position: .Left) delegate?.sideNavigationDidTap?(self, point: recognizer.locationInView(view), position: .Left)
...@@ -738,6 +782,15 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -738,6 +782,15 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
} }
} }
} }
}
/**
A method that is fired when the tap gesture is recognized
for the rightView.
- Parameter recognizer: A UITapGestureRecognizer that is
passed to the handler when recognized.
*/
internal func handleRightViewTapGesture(recognizer: UITapGestureRecognizer) {
if openedRightView { if openedRightView {
if let v: MaterialView = rightView { if let v: MaterialView = rightView {
delegate?.sideNavigationDidTap?(self, point: recognizer.locationInView(view), position: .Right) delegate?.sideNavigationDidTap?(self, point: recognizer.locationInView(view), position: .Right)
...@@ -763,7 +816,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -763,7 +816,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
prepareRightView() prepareRightView()
prepareLeftViewController() prepareLeftViewController()
prepareRightViewController() prepareRightViewController()
prepareGestures() prepareLeftViewGestures()
prepareRightViewGestures()
} }
/// A method that prepares the rootViewController. /// A method that prepares the rootViewController.
...@@ -843,61 +897,87 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -843,61 +897,87 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
} }
} }
/** /// A method that prepares the gestures used within the leftView.
A method that prepares the gestures used within the private func prepareLeftViewGestures() {
SideNavigationController. if nil == panLeftViewGesture {
*/ panLeftViewGesture = UIPanGestureRecognizer(target: self, action: #selector(handleLeftViewPanGesture(_:)))
private func prepareGestures() { panLeftViewGesture!.delegate = self
if nil == panGesture { view.addGestureRecognizer(panLeftViewGesture!)
panGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture))
panGesture!.delegate = self
view.addGestureRecognizer(panGesture!)
} }
if nil == tapGesture { if nil == tapLeftViewGesture {
tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTapGesture)) tapLeftViewGesture = UITapGestureRecognizer(target: self, action: #selector(handleLeftViewTapGesture(_:)))
tapGesture!.delegate = self tapLeftViewGesture!.delegate = self
tapGesture!.cancelsTouchesInView = false tapLeftViewGesture!.cancelsTouchesInView = false
view.addGestureRecognizer(tapGesture!) view.addGestureRecognizer(tapLeftViewGesture!)
} }
} }
/** /// A method that prepares the gestures used within the rightView.
A method that removes the passed in pan and tap gesture private func prepareRightViewGestures() {
recognizers. if nil == panRightViewGesture {
*/ panRightViewGesture = UIPanGestureRecognizer(target: self, action: #selector(handleRightViewPanGesture(_:)))
private func removeGestures() { panRightViewGesture!.delegate = self
if let v: UIPanGestureRecognizer = panGesture { view.addGestureRecognizer(panRightViewGesture!)
}
if nil == tapRightViewGesture {
tapRightViewGesture = UITapGestureRecognizer(target: self, action: #selector(handleRightViewTapGesture(_:)))
tapRightViewGesture!.delegate = self
tapRightViewGesture!.cancelsTouchesInView = false
view.addGestureRecognizer(tapRightViewGesture!)
}
}
/// A method that removes the passed in pan and leftView tap gesture recognizers.
private func removeLeftViewGestures() {
if let v: UIPanGestureRecognizer = panLeftViewGesture {
view.removeGestureRecognizer(v)
panLeftViewGesture = nil
}
if let v: UITapGestureRecognizer = tapLeftViewGesture {
view.removeGestureRecognizer(v)
tapLeftViewGesture = nil
}
}
/// A method that removes the passed in pan and rightView tap gesture recognizers.
private func removeRightViewGestures() {
if let v: UIPanGestureRecognizer = panRightViewGesture {
view.removeGestureRecognizer(v) view.removeGestureRecognizer(v)
panGesture = nil panRightViewGesture = nil
} }
if let v: UITapGestureRecognizer = tapGesture { if let v: UITapGestureRecognizer = tapRightViewGesture {
view.removeGestureRecognizer(v) view.removeGestureRecognizer(v)
tapGesture = nil tapRightViewGesture = nil
} }
} }
/// Shows the statusBar. /// Shows the statusBar.
private func showStatusBar() { private func showStatusBar() {
willHideStatusBar = false willHideStatusBar = false
UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration), if MaterialDevice.statusBarHidden {
animations: { [weak self] in UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration),
self?.setNeedsStatusBarAppearanceUpdate() animations: { [weak self] in
MaterialDevice.statusBarHidden = false self?.setNeedsStatusBarAppearanceUpdate()
}) MaterialDevice.statusBarHidden = false
delegate?.sideNavigationStatusBarHiddenState?(self, hidden: false) })
delegate?.sideNavigationStatusBarHiddenState?(self, hidden: false)
}
} }
/// Hides the statusBar. /// Hides the statusBar.
private func hideStatusBar() { private func hideStatusBar() {
if enableHideStatusbar { if enableHideStatusbar {
willHideStatusBar = true if !MaterialDevice.statusBarHidden {
UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration), willHideStatusBar = true
animations: { [weak self] in UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration),
self?.setNeedsStatusBarAppearanceUpdate() animations: { [weak self] in
MaterialDevice.statusBarHidden = true self?.setNeedsStatusBarAppearanceUpdate()
}) MaterialDevice.statusBarHidden = true
delegate?.sideNavigationStatusBarHiddenState?(self, hidden: true) })
delegate?.sideNavigationStatusBarHiddenState?(self, hidden: true)
}
} }
} }
...@@ -919,8 +999,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -919,8 +999,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
- Returns: A Boolean of the result, true if yes, false - Returns: A Boolean of the result, true if yes, false
otherwise. otherwise.
*/ */
private func isPointContainedWithinLeftViewThreshold(point: CGPoint) -> Bool { private func isPointContainedWithinLeftThreshold(point: CGPoint) -> Bool {
return point.x <= leftViewThreshold return point.x <= leftThreshold
} }
/** /**
...@@ -932,8 +1012,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -932,8 +1012,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
- Returns: A Boolean of the result, true if yes, false - Returns: A Boolean of the result, true if yes, false
otherwise. otherwise.
*/ */
private func isPointContainedWithinRightViewThreshold(point: CGPoint) -> Bool { private func isPointContainedWithinRighThreshold(point: CGPoint) -> Bool {
return point.x >= rightViewThreshold return point.x >= view.bounds.width - rightThreshold
} }
/** /**
...@@ -977,7 +1057,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -977,7 +1057,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
if let v: MaterialView = leftView { if let v: MaterialView = leftView {
v.width = leftViewWidth v.width = leftViewWidth
v.height = view.bounds.height v.height = view.bounds.height
leftViewThreshold = nil == leftThreshold ? leftViewWidth / 2 : leftThreshold! leftViewThreshold = leftViewWidth / 2
if let vc: UIViewController = leftViewController { if let vc: UIViewController = leftViewController {
vc.view.frame.size.width = v.width vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height vc.view.frame.size.height = v.height
...@@ -988,7 +1068,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -988,7 +1068,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
if let v: MaterialView = rightView { if let v: MaterialView = rightView {
v.width = rightViewWidth v.width = rightViewWidth
v.height = view.bounds.height v.height = view.bounds.height
rightViewThreshold = nil == rightThreshold ? view.bounds.width - rightViewWidth / 2 : view.bounds.width - rightThreshold! rightViewThreshold = view.bounds.width - rightViewWidth / 2
if let vc: UIViewController = rightViewController { if let vc: UIViewController = rightViewController {
vc.view.frame.size.width = v.width vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height vc.view.frame.size.height = v.height
......
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