Merge tag '2.1.5'

* tag '2.1.5':
  Update README for Cocoapods.
  Update pod spec.
  Refactoring.
  Second fix for multiple gestures actuating and causing problem.
This commit is contained in:
jonkykong
2017-01-12 14:20:44 -08:00
3 changed files with 25 additions and 42 deletions
+16 -33
View File
@@ -321,29 +321,26 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
// get reference to our fromView, toView and the container view that we should perform the transition in
let container = transitionContext.containerView
// prevent any other menu gestures from firing
container.isUserInteractionEnabled = false
if let menuBackgroundColor = SideMenuManager.menuAnimationBackgroundColor {
container.backgroundColor = menuBackgroundColor
}
// create a tuple of our screens
let screens : (from:UIViewController, to:UIViewController) = (transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)!, transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)!)
let fromViewController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)!
let toViewController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)!
// assign references to our menu view controller and the 'bottom' view controller from the tuple
// remember that our menuViewController will alternate between the from and to view controller depending if we're presenting or dismissing
let menuViewController = (!presenting ? screens.from : screens.to)
let topViewController = !presenting ? screens.to : screens.from
let menuViewController = presenting ? toViewController : fromViewController
let topViewController = presenting ? fromViewController : toViewController
let menuView = menuViewController.view!
let topView = topViewController.view!
// prepare menu items to slide in
if presenting {
var tapView: UIView?
if !SideMenuManager.menuPresentingViewControllerUserInteractionEnabled {
tapView = UIView()
SideMenuTransition.tapView = tapView
}
SideMenuTransition.originalSuperview = topView.superview
// add the both views to our view controller
@@ -351,17 +348,11 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
case .viewSlideOut, .viewSlideInOut:
container.addSubview(menuView)
container.addSubview(topView)
if let tapView = tapView {
topView.addSubview(tapView)
}
case .menuSlideIn, .menuDissolveIn:
container.addSubview(topView)
if let tapView = tapView {
container.addSubview(tapView)
}
container.addSubview(menuView)
}
if SideMenuManager.menuFadeStatusBar {
let statusBarView = UIView()
SideMenuTransition.statusBarView = statusBarView
@@ -371,16 +362,6 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
SideMenuTransition.hideMenuStart()
}
let enableTapViewGestures = { (enable: Bool) in
guard let gestures = SideMenuTransition.tapView?.gestureRecognizers else {
return
}
for gesture in gestures {
gesture.isEnabled = enable
}
}
// perform the animation!
let duration = transitionDuration(using: transitionContext)
let options: UIViewAnimationOptions = interactive ? .curveLinear : UIViewAnimationOptions()
@@ -390,10 +371,10 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
} else {
SideMenuTransition.hideMenuStart()
}
menuView.isUserInteractionEnabled = false
enableTapViewGestures(false)
}) { (finished) -> Void in
container.isUserInteractionEnabled = true
// tell our transitionContext object that we've finished animating
if transitionContext.transitionWasCancelled {
let viewControllerForPresentedMenu = SideMenuTransition.viewControllerForPresentedMenu
@@ -403,8 +384,6 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
} else {
SideMenuTransition.presentMenuComplete()
}
menuView.isUserInteractionEnabled = true
enableTapViewGestures(true)
transitionContext.completeTransition(false)
@@ -418,8 +397,12 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
if self.presenting {
SideMenuTransition.presentMenuComplete()
menuView.isUserInteractionEnabled = true
enableTapViewGestures(true)
if !SideMenuManager.menuPresentingViewControllerUserInteractionEnabled {
let tapView = UIView()
topView.addSubview(tapView)
tapView.frame = topView.bounds
SideMenuTransition.tapView = tapView
}
transitionContext.completeTransition(true)
switch SideMenuManager.menuPresentMode {
case .viewSlideOut, .viewSlideInOut:
+8 -8
View File
@@ -4,19 +4,19 @@
[![License](https://img.shields.io/cocoapods/l/SideMenu.svg?style=flat)](http://cocoapods.org/pods/SideMenu)
[![Platform](https://img.shields.io/cocoapods/p/SideMenu.svg?style=flat)](http://cocoapods.org/pods/SideMenu)
### If you like SideMenu, give it a ★ at the top right of this page.
### If you like SideMenu, give it a ★ at the top right of its [GitHub](https://github.com/jonkykong/SideMenu) page.
My name is Jon Kent and I'm a freelance iOS designer, developer, and mobile strategist. I love coffee and play the drums. [**Hire me**](mailto:contact@jonkent.me?subject=Let's build something amazing.) to help you make cool stuff. I also have a [website](http://jonkent.me). *Note: If you're having a problem with SideMenu, please open an [issue](https://github.com/jonkykong/SideMenu/issues/new) and do not email me.*
## Overview
SideMenu is a simple and versatile side menu control written in Swift.
- [x] **It can be implemented in storyboard without a single line of [code](#code-less-storyboard-implementation).**
- [x] Four standard animation styles to choose from (even parallax if you want to get weird).
- [x] Highly customizable without needing to write tons of custom code.
- [x] Supports continuous swiping between side menus on boths sides in a single gesture.
- [x] Global menu configuration. Set-up once and be done for all screens.
- [x] Menus can be presented and dismissed the same as any other View Controller since this control uses custom transitions.
* **It can be implemented in storyboard without a single line of [code](#code-less-storyboard-implementation).**
* Four standard animation styles to choose from (even parallax if you want to get weird).
* Highly customizable without needing to write tons of custom code.
* Supports continuous swiping between side menus on boths sides in a single gesture.
* Global menu configuration. Set-up once and be done for all screens.
* Menus can be presented and dismissed the same as any other View Controller since this control uses custom transitions.
Check out the example project to see it in action!
@@ -26,7 +26,7 @@ Check out the example project to see it in action!
![](etc/InOut.gif)
## Requirements
- [x] iOS 8 or higher
* iOS 8 or higher
## Installation
### CocoaPods
+1 -1
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "SideMenu"
s.version = "2.1.4"
s.version = "2.1.5"
s.summary = "Simple side menu control for iOS in Swift inspired by Facebook. Right and Left sides. No coding required."
# This description is used to generate tags and improve search results.