Compare commits

...

12 Commits

Author SHA1 Message Date
jonkykong 065e6e236e Updated pod spec/readme. 2016-12-28 13:04:30 -06:00
jonkykong 143a8cdde9 Updated project settings. 2016-12-28 13:01:46 -06:00
jonkykong cadb63bf21 Merge branch 'master' into 2.0.8
* master:
  Update CONTRIBUTING.md
  Update README.md
  Update README.md
  Update ISSUE_TEMPLATE.md
  Update ISSUE_TEMPLATE.md
  Update ISSUE_TEMPLATE.md
  Create ISSUE_TEMPLATE.md
  Create CONTRIBUTING.md
  Silence warning of unused variable.
2016-12-28 12:59:59 -06:00
jonkykong 6903ffb958 Refactor of logic for menuEnableSwipeGestures so it won’t conflict with swipe based controls (UISlider) in menu. 2016-12-28 12:56:55 -06:00
Jon Kent ac5c1eaba6 Update CONTRIBUTING.md 2016-12-21 12:27:10 -06:00
Jon Kent db4eb5380d Update README.md 2016-12-17 20:04:56 -08:00
Jon Kent 5d08277cd4 Update README.md 2016-12-15 11:49:09 -08:00
Jon Kent 2798c61d73 Update ISSUE_TEMPLATE.md 2016-12-14 20:54:40 -08:00
Jon Kent 8037148fd2 Update ISSUE_TEMPLATE.md 2016-12-14 20:54:18 -08:00
Jon Kent 2b8e46d503 Update ISSUE_TEMPLATE.md 2016-12-14 20:46:55 -08:00
Jon Kent 49841b0b4e Create ISSUE_TEMPLATE.md 2016-12-14 20:41:46 -08:00
Jon Kent 516e845da7 Create CONTRIBUTING.md 2016-12-14 20:20:04 -08:00
8 changed files with 106 additions and 76 deletions
+17
View File
@@ -0,0 +1,17 @@
# Contribution Guidelines
Thank you for your interest in SideMenu!
I have received a surprising amount of questions about SideMenu since putting it up here. A few people in the community have identified some problems and helped contribute to SideMenu to make it better for everyone and I'm truly grateful for the support! Keep them coming!
I have also received a number of questions about people having issues implementing SideMenu, mostly from beginners learning how to code. As much as I would love to help all of you, I simply do **not** have the time to teach you. That's why I spent a lot of time putting together a detailed [README](https://github.com/jonkykong/SideMenu/blob/master/README.md), adding comments about usage in code, and providing a [demo project](https://github.com/jonkykong/SideMenu/tree/master/Example). These will give you all the information you need to work through any problem and also save me the time it takes to personally respond. **It is faster for you to figure it out for yourself instead of waiting for me to respond to you.**
### If your question begins with _"How do I..."_
- It's **not** a bug. Stay persistent, try a few different things, and you will figure it out! I also recommend searching and posting your questions on [stackoverflow.com](stackoverflow.com). Or, if you're interested in hiring me to teach you, please email me using the email address listed at the top of my [README](https://github.com/jonkykong/SideMenu/blob/master/README.md).
### If your question begins with _"Can I..."_
- That's a **new feature request**. I am no longer investing my personal time to implement one-off features because SideMenu currently meets the majority of people's needs with the features it already has. However, this is a great opportunity for you to contribute to this open source project! Feel free to open an issue to ask any clarifying questions for your new feature before you start building. Open a [pull request](https://github.com/jonkykong/SideMenu/pull/new/master) when you're ready for me to merge it.
**Again**, please do **not** email me or open any issues if you want to know how to use SideMenu or are having trouble getting it to work. However, if you think you found a bug, open an issue and I will respond to it as quickly as I can. You should be able to demonstrate the bug in the [demo project](https://github.com/jonkykong/SideMenu/tree/master/Example) which has a minimal amount of code.
Thanks again for your support and for being respectful of my time.
+12
View File
@@ -0,0 +1,12 @@
<!--- Provide a general summary of your changes in the Title above -->
## New Issue Checklist
<!--- Please complete all of the checks below before submitting a new issue -->
I have read the [guidelines for contributing](https://github.com/jonkykong/SideMenu/blob/master/.github/CONTRIBUTING.md) and I understand:
- [ ] My issue was **not** solved in the [README](https://github.com/jonkykong/SideMenu/blob/master/README.md).
- [ ] My issue can **not** be answered on [stackoverflow.com](stackoverflow.com).
- [ ] My issue is **not** a request for new functionality that I am unwilling to build and contribute with a pull request.
- [ ] My issue **is** reproducible in the [demo project](https://github.com/jonkykong/SideMenu/tree/master/Example).
## Issue Description
<!--- After completing all of the checks above, describe the issue here -->
+11 -15
View File
@@ -4,17 +4,20 @@
[![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.
## Shameless Plugs
### 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).
## 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!
@@ -24,7 +27,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
@@ -224,13 +227,6 @@ Don't try to change the status bar appearance when presenting a menu. When used
## Thank You
A special thank you to everyone that has [contributed](https://github.com/jonkykong/SideMenu/graphs/contributors) to this library to make it better. Your support is appreciated!
## About Me
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!**
🌎 Web: [http://jonkent.me](http://jonkent.me)
✉️ Email: [contact@jonkent.me](mailto:contact@jonkent.me) **IMPORTANT: Before emailing me, please read [this](https://github.com/jonkykong/SideMenu/issues/58).**
## License
SideMenu is available under the MIT license. See the LICENSE file for more info.
+1 -1
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "SideMenu"
s.version = "2.0.7"
s.version = "2.0.8"
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.
+1 -1
View File
@@ -279,7 +279,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0820;
ORGANIZATIONNAME = jonkykong;
TargetAttributes = {
7B48A0D21DCB2487002990A1 = {
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0810"
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
+25 -13
View File
@@ -81,9 +81,6 @@ open class SideMenuManager : NSObject {
/// The right menu swipe to dismiss gesture.
open static weak var menuRightSwipeToDismissGesture: UIPanGestureRecognizer?
/// Enable or disable gestures that would swipe to present or dismiss the menu. Default is true.
open static var menuEnableSwipeGestures: Bool = true
/// Enable or disable interaction with the presenting view controller while the menu is displayed. Enabling may make it difficult to dismiss the menu or cause exceptions if the user tries to present and already presented menu. Default is false.
open static var menuPresentingViewControllerUserInteractionEnabled: Bool = false
@@ -96,6 +93,9 @@ open class SideMenuManager : NSObject {
/// When true, pushViewController called within the menu it will push the new view controller inside of the menu. Otherwise, it is pushed on the menu's presentingViewController. Default is false.
open static var menuAllowSubmenus: Bool = false
/// When true, pushViewController will replace the last view controller in the navigation controller's viewController stack instead of appending to it. This makes menus similar to tab bar controller behavior.
open static var menuReplaceOnPush: Bool = false
/// -Warning: Deprecated. Use `menuAnimationTransformScaleFactor` instead.
@available(*, deprecated, renamed: "menuAnimationTransformScaleFactor")
open static var menuAnimationShrinkStrength: CGFloat {
@@ -162,20 +162,32 @@ open class SideMenuManager : NSObject {
return
}
let exitPanGesture = UIPanGestureRecognizer()
exitPanGesture.addTarget(SideMenuTransition.self, action:#selector(SideMenuTransition.handleHideMenuPan(_:)))
forMenu.view.addGestureRecognizer(exitPanGesture)
if menuEnableSwipeGestures {
let exitPanGesture = UIPanGestureRecognizer()
exitPanGesture.addTarget(SideMenuTransition.self, action:#selector(SideMenuTransition.handleHideMenuPan(_:)))
forMenu.view.addGestureRecognizer(exitPanGesture)
if leftSide {
menuLeftSwipeToDismissGesture = exitPanGesture
} else {
menuRightSwipeToDismissGesture = exitPanGesture
}
}
forMenu.transitioningDelegate = SideMenuTransition.singleton
forMenu.modalPresentationStyle = .overFullScreen
forMenu.leftSide = leftSide
if leftSide {
menuLeftSwipeToDismissGesture = exitPanGesture
} else {
menuRightSwipeToDismissGesture = exitPanGesture
}
updateMenuBlurIfNecessary()
}
/// Enable or disable gestures that would swipe to present or dismiss the menu. Default is true.
open static var menuEnableSwipeGestures: Bool = true {
didSet {
menuLeftSwipeToDismissGesture?.view?.removeGestureRecognizer(menuLeftSwipeToDismissGesture!)
menuRightSwipeToDismissGesture?.view?.removeGestureRecognizer(menuRightSwipeToDismissGesture!)
setupNavigationController(menuLeftNavigationController, leftSide: true)
setupNavigationController(menuRightNavigationController, leftSide: false)
}
}
fileprivate class func updateMenuBlurIfNecessary() {
let menuBlurBlock = { (forMenu: UISideMenuNavigationController?) in
if let forMenu = forMenu {
@@ -194,7 +206,7 @@ open class SideMenuManager : NSObject {
let menuBlurEffectStyle = menuBlurEffectStyle,
let view = forMenu.visibleViewController?.view
, !UIAccessibilityIsReduceTransparencyEnabled() else {
return
return
}
if forMenu.originalMenuBackgroundColor == nil {
@@ -219,7 +231,7 @@ open class SideMenuManager : NSObject {
guard let forMenu = forMenu,
let originalMenuBackgroundColor = forMenu.originalMenuBackgroundColor,
let view = forMenu.visibleViewController?.view else {
return
return
}
view.backgroundColor = originalMenuBackgroundColor
+38 -45
View File
@@ -58,10 +58,6 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
}
internal class func handlePresentMenuPan(_ pan: UIPanGestureRecognizer) {
guard SideMenuManager.menuEnableSwipeGestures else {
return
}
// how much distance have we panned in reference to the parent view?
guard let view = viewControllerForPresentedMenu != nil ? viewControllerForPresentedMenu?.view : pan.view else {
return
@@ -125,10 +121,6 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
}
internal class func handleHideMenuPan(_ pan: UIPanGestureRecognizer) {
if !SideMenuManager.menuEnableSwipeGestures {
return
}
let translation = pan.translation(in: pan.view!)
let direction:CGFloat = SideMenuTransition.presentDirection == .left ? -1 : 1
let distance = translation.x / SideMenuManager.menuWidth * direction
@@ -373,48 +365,48 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
SideMenuTransition.hideMenuStart()
}
menuView?.isUserInteractionEnabled = false
}) { (finished) -> Void in
// tell our transitionContext object that we've finished animating
if transitionContext.transitionWasCancelled {
let viewControllerForPresentedMenu = SideMenuTransition.viewControllerForPresentedMenu
if self.presenting {
SideMenuTransition.hideMenuComplete()
} else {
SideMenuTransition.presentMenuComplete()
}
menuView?.isUserInteractionEnabled = true
transitionContext.completeTransition(false)
if SideMenuTransition.switchMenus {
SideMenuTransition.switchMenus = false
viewControllerForPresentedMenu?.present(SideMenuTransition.presentDirection == .left ? SideMenuManager.menuLeftNavigationController! : SideMenuManager.menuRightNavigationController!, animated: true, completion: nil)
}
return
}
}) { (finished) -> Void in
// tell our transitionContext object that we've finished animating
if transitionContext.transitionWasCancelled {
let viewControllerForPresentedMenu = SideMenuTransition.viewControllerForPresentedMenu
if self.presenting {
SideMenuTransition.hideMenuComplete()
} else {
SideMenuTransition.presentMenuComplete()
menuView?.isUserInteractionEnabled = true
transitionContext.completeTransition(true)
switch SideMenuManager.menuPresentMode {
case .viewSlideOut, .viewSlideInOut:
container.addSubview(topView!)
case .menuSlideIn, .menuDissolveIn:
container.insertSubview(topView!, at: 0)
}
if let statusBarView = SideMenuTransition.statusBarView {
container.bringSubview(toFront: statusBarView)
}
return
}
menuView?.isUserInteractionEnabled = true
transitionContext.completeTransition(false)
if SideMenuTransition.switchMenus {
SideMenuTransition.switchMenus = false
viewControllerForPresentedMenu?.present(SideMenuTransition.presentDirection == .left ? SideMenuManager.menuLeftNavigationController! : SideMenuManager.menuRightNavigationController!, animated: true, completion: nil)
}
SideMenuTransition.hideMenuComplete()
return
}
if self.presenting {
SideMenuTransition.presentMenuComplete()
menuView?.isUserInteractionEnabled = true
transitionContext.completeTransition(true)
menuView?.removeFromSuperview()
switch SideMenuManager.menuPresentMode {
case .viewSlideOut, .viewSlideInOut:
container.addSubview(topView!)
case .menuSlideIn, .menuDissolveIn:
container.insertSubview(topView!, at: 0)
}
if let statusBarView = SideMenuTransition.statusBarView {
container.bringSubview(toFront: statusBarView)
}
return
}
SideMenuTransition.hideMenuComplete()
transitionContext.completeTransition(true)
menuView?.removeFromSuperview()
}
}
@@ -450,7 +442,8 @@ open class SideMenuTransition: UIPercentDrivenInteractiveTransition, UIViewContr
}
internal func applicationDidEnterBackgroundNotification() {
if let menuViewController: UINavigationController = SideMenuTransition.presentDirection == .left ? SideMenuManager.menuLeftNavigationController : SideMenuManager.menuRightNavigationController {
if let menuViewController: UINavigationController = SideMenuTransition.presentDirection == .left ? SideMenuManager.menuLeftNavigationController : SideMenuManager.menuRightNavigationController,
menuViewController.presentedViewController == nil {
SideMenuTransition.hideMenuStart()
SideMenuTransition.hideMenuComplete()
menuViewController.dismiss(animated: false, completion: nil)