Compare commits

...

4 Commits

Author SHA1 Message Date
jonkykong 0a457b414e Updated podspec 2019-08-14 02:20:38 -07:00
jonkykong 5abf5ca740 Updated screenshot 2019-08-14 02:20:25 -07:00
jonkykong 498669bf58 Updated README 2019-08-14 02:16:18 -07:00
jonkykong 159c87871b Expanded renaming to include delegates 2019-08-14 02:16:02 -07:00
8 changed files with 60 additions and 57 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ class MainViewController: UIViewController {
}
}
extension MainViewController: UISideMenuNavigationControllerDelegate {
extension MainViewController: SideMenuNavigationControllerDelegate {
func sideMenuWillAppear(menu: SideMenuNavigationController, animated: Bool) {
print("SideMenu Appearing! (animated: \(animated))")
+23 -20
View File
@@ -20,43 +20,43 @@ extension SideMenuManager {
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuPresentMode: SideMenuPresentationStyle {
get { return .viewSlideOut }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuPushStyle: SideMenuPushStyle {
get { return .default }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuAllowPushOfSameClassTwice: Bool {
get { return true }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuWidth: CGFloat {
get { return 0 }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuAnimationPresentDuration: Double {
get { return 0.35 }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuAnimationDismissDuration: Double {
get { return 0.35 }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuAnimationCompleteGestureDuration: Double {
get { return 0.35 }
set {}
@@ -98,7 +98,7 @@ extension SideMenuManager {
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuPresentingViewControllerUserInteractionEnabled: Bool {
get { return false }
set {}
@@ -110,73 +110,73 @@ extension SideMenuManager {
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuFadeStatusBar: Bool {
get { return true }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuAnimationOptions: UIView.AnimationOptions {
get { return .curveEaseInOut }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuAnimationCompletionCurve: UIView.AnimationCurve {
get { return .easeIn }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuAnimationUsingSpringWithDamping: CGFloat {
get { return 1 }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuAnimationInitialSpringVelocity: CGFloat {
get { return 1 }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuDismissOnPush: Bool {
get { return true }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuAlwaysAnimate: Bool {
get { return false }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuDismissWhenBackgrounded: Bool {
get { return true }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuBlurEffectStyle: UIBlurEffect.Style? {
get { return nil }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public weak var menuLeftSwipeToDismissGesture: UIPanGestureRecognizer? {
get { return nil }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public weak var menuRightSwipeToDismissGesture: UIPanGestureRecognizer? {
get { return nil }
set {}
}
@available(*, deprecated, message: "This property has been moved to the UISideMenuNavigationController class.")
@available(*, deprecated, message: "This property has been moved to the SideMenuNavigationController class.")
public var menuEnableSwipeGestures: Bool {
get { return true }
set {}
@@ -209,3 +209,6 @@ extension SideMenuPresentationStyle {
@available(*, deprecated, renamed: "SideMenuNavigationController")
public typealias UISideMenuNavigationController = SideMenuNavigationController
@available(*, deprecated, renamed: "SideMenuNavigationControllerDelegate")
public typealias UISideMenuNavigationControllerDelegate = SideMenuNavigationControllerDelegate
+2 -2
View File
@@ -9,8 +9,8 @@ import Foundation
internal enum Print: String { case
cannotPush = "Attempt to push a View Controller from %@ where its navigationController == nil. It must be embedded in a UINavigationController for this to work.",
emptyMenu = "The menu doesn't have a view controller to show! UISideMenuNavigationController needs a view controller to display just like a UINavigationController.",
menuAlreadyAssigned = "%@ was already assigned to the %@ of %@. When using multiple SideMenuManagers you may want to use new instances of UISideMenuNavigationController instead of existing instances to avoid crashes if the menu is presented more than once.",
emptyMenu = "The menu doesn't have a view controller to show! SideMenuNavigationController needs a view controller to display just like a UINavigationController.",
menuAlreadyAssigned = "%@ was already assigned to the %@ of %@. When using multiple SideMenuManagers you may want to use new instances of SideMenuNavigationController instead of existing instances to avoid crashes if the menu is presented more than once.",
menuInUse = "%@ cannot be modified while it's presented.",
panGestureAdded = "%@ was called before %@ or %@ was set. Gestures will not work without a menu.",
property = "A menu's %@ property can only be changed when it is hidden.",
+1 -1
View File
@@ -221,7 +221,7 @@ private extension SideMenuManager {
}
}
extension SideMenuManager: UISideMenuNavigationControllerTransitionDelegate {
extension SideMenuManager: SideMenuNavigationControllerTransitionDelegate {
internal func sideMenuTransitionDidDismiss(menu: Menu) {
defer { switching = false }
@@ -1,5 +1,5 @@
//
// UISideMenuNavigationController.swift
// SideMenuNavigationController.swift
//
// Created by Jon Kent on 1/14/16.
// Copyright © 2016 Jon Kent. All rights reserved.
@@ -16,14 +16,14 @@ import UIKit
subMenu
}
@objc public protocol UISideMenuNavigationControllerDelegate {
@objc public protocol SideMenuNavigationControllerDelegate {
@objc optional func sideMenuWillAppear(menu: SideMenuNavigationController, animated: Bool)
@objc optional func sideMenuDidAppear(menu: SideMenuNavigationController, animated: Bool)
@objc optional func sideMenuWillDisappear(menu: SideMenuNavigationController, animated: Bool)
@objc optional func sideMenuDidDisappear(menu: SideMenuNavigationController, animated: Bool)
}
internal protocol UISideMenuNavigationControllerTransitionDelegate: class {
internal protocol SideMenuNavigationControllerTransitionDelegate: class {
func sideMenuTransitionDidDismiss(menu: Menu)
}
@@ -79,8 +79,8 @@ open class SideMenuNavigationController: UINavigationController {
private var rotating: Bool = false
private var transitionController: SideMenuTransitionController?
/// Delegate for receiving appear and disappear related events. If `nil` the visible view controller that displays a `UISideMenuNavigationController` automatically receives these events.
internal weak var sideMenuDelegate: UISideMenuNavigationControllerDelegate?
/// Delegate for receiving appear and disappear related events. If `nil` the visible view controller that displays a `SideMenuNavigationController` automatically receives these events.
internal weak var sideMenuDelegate: SideMenuNavigationControllerDelegate?
/// The swipe to dismiss gesture.
open private(set) weak var swipeToDismissGesture: UIPanGestureRecognizer? = nil
@@ -540,12 +540,12 @@ internal extension SideMenuNavigationController {
private extension SideMenuNavigationController {
weak var activeDelegate: UISideMenuNavigationControllerDelegate? {
weak var activeDelegate: SideMenuNavigationControllerDelegate? {
guard !view.isHidden else { return nil }
if let sideMenuDelegate = sideMenuDelegate {
return sideMenuDelegate
}
return visibleViewController(from: presentingViewController) as? UISideMenuNavigationControllerDelegate
return visibleViewController(from: presentingViewController) as? SideMenuNavigationControllerDelegate
}
func visibleViewController(from: UIViewController?) -> UIViewController? {
+25 -25
View File
@@ -24,8 +24,8 @@
* [Code Implementation](#code-implementation)
* **[Customization](#customization)**
* [SideMenuManager](#sidemenumanager)
* [UISideMenuNavigationController](#uisidemenunavigationcontroller)
* [UISideMenuNavigationControllerDelegate](#uisidemenunavigationcontrollerdelegate)
* [SideMenuNavigationController](#sidemenunavigationcontroller)
* [SideMenuNavigationControllerDelegate](#sidemenunavigationcontrollerdelegate)
* [Advanced](#advanced)
* [Known Issues](#known-issues)
* [Thank You](#thank-you)
@@ -104,10 +104,10 @@ github "jonkykong/SideMenu" "master"
## Usage
### Code-less Storyboard Implementation
1. Create a Navigation Controller for a side menu. Set the `Custom Class` of the Navigation Controller to be `UISideMenuNavigationController` in the **Identity Inspector**. Set the `Module` to `SideMenu` (ignore this step if you've manually added SideMenu to your project). Create a Root View Controller for the Navigation Controller (shown as a UITableViewController below). Set up any Triggered Segues you want in that view controller.
1. Create a Navigation Controller for a side menu. Set the `Custom Class` of the Navigation Controller to be `SideMenuNavigationController` in the **Identity Inspector**. Set the `Module` to `SideMenu` (ignore this step if you've manually added SideMenu to your project). Create a Root View Controller for the Navigation Controller (shown as a UITableViewController below). Set up any Triggered Segues you want in that view controller.
![](https://raw.githubusercontent.com/jonkykong/SideMenu/master/etc/Screenshot1.png)
2. Set the `Left Side` property of the `UISideMenuNavigationController` to On if you want it to appear from the left side of the screen, or Off/Default if you want it to appear from the right side.
2. Set the `Left Side` property of the `SideMenuNavigationController` to On if you want it to appear from the left side of the screen, or Off/Default if you want it to appear from the right side.
![](https://raw.githubusercontent.com/jonkykong/SideMenu/master/etc/Screenshot2.png)
3. Add a UIButton or UIBarButton to a view controller that you want to display the menu from. Set that button's Triggered Segues action to modally present the Navigation Controller from step 1.
@@ -123,10 +123,10 @@ import SideMenu
From a button, do something like this:
``` swift
// Define the menu
let menu = UISideMenuNavigationController(rootViewController: YourViewController)
// UISideMenuNavigationController is a subclass of UINavigationController, so do any additional configuration
let menu = SideMenuNavigationController(rootViewController: YourViewController)
// SideMenuNavigationController is a subclass of UINavigationController, so do any additional configuration
// of it here like setting its viewControllers. If you're using storyboards, you'll want to do something like:
// let menu = storyboard!.instantiateViewController(withIdentifier: "RightMenu") as! UISideMenuNavigationController
// let menu = storyboard!.instantiateViewController(withIdentifier: "RightMenu") as! SideMenuNavigationController
present(menu, animated: true, completion: nil)
```
@@ -138,10 +138,10 @@ dismiss(animated: true, completion: nil)
To use gestures you have to use the `SideMenuManager`. In your `AppDelegate` do something like this:
``` swift
// Define the menus
let leftMenuNavigationController = UISideMenuNavigationController(rootViewController: YourViewController)
let leftMenuNavigationController = SideMenuNavigationController(rootViewController: YourViewController)
SideMenuManager.default.leftMenuNavigationController = leftMenuNavigationController
let rightMenuNavigationController = UISideMenuNavigationController(rootViewController: YourViewController)
let rightMenuNavigationController = SideMenuNavigationController(rootViewController: YourViewController)
SideMenuManager.default.rightMenuNavigationController = rightMenuNavigationController
// Setup gestures: the left and/or right menus must be set up (above) for these to work.
@@ -160,9 +160,9 @@ That's it.
`SideMenuManager` supports the following:
``` swift
/// The left menu.
open var leftMenuNavigationController: UISideMenuNavigationController?
open var leftMenuNavigationController: SideMenuNavigationController?
/// The right menu.
public var rightMenuNavigationController: UISideMenuNavigationController?
public var rightMenuNavigationController: SideMenuNavigationController?
/**
Adds screen edge gestures for both left and right sides to a view to present a menu.
@@ -189,8 +189,8 @@ public var rightMenuNavigationController: UISideMenuNavigationController?
*/
@discardableResult public func addPanGestureToPresent(toView view: UIView) -> UIPanGestureRecognizer
```
#### UISideMenuNavigationController
`UISideMenuNavigationController` supports the following:
#### SideMenuNavigationController
`SideMenuNavigationController` supports the following:
``` swift
/// Prevents the same view controller (or a view controller of the same class) from being pushed more than once. Defaults to true.
var allowPushOfSameClassTwice: Bool = true
@@ -275,29 +275,29 @@ static let viewSlideOutMenuPartialOut: SideMenuPresentStyle
/// The existing view slides out and shrinks to reveal the menu underneath.
static let viewSlideOutMenuZoom: SideMenuPresentStyle
```
#### UISideMenuNavigationControllerDelegate
To receive notifications when a menu is displayed from a view controller, have it adhere to the `UISideMenuNavigationControllerDelegate` protocol:
#### SideMenuNavigationControllerDelegate
To receive notifications when a menu is displayed from a view controller, have it adhere to the `SideMenuNavigationControllerDelegate` protocol:
``` swift
extension MyViewController: UISideMenuNavigationControllerDelegate {
extension MyViewController: SideMenuNavigationControllerDelegate {
func sideMenuWillAppear(menu: UISideMenuNavigationController, animated: Bool) {
func sideMenuWillAppear(menu: SideMenuNavigationController, animated: Bool) {
print("SideMenu Appearing! (animated: \(animated))")
}
func sideMenuDidAppear(menu: UISideMenuNavigationController, animated: Bool) {
func sideMenuDidAppear(menu: SideMenuNavigationController, animated: Bool) {
print("SideMenu Appeared! (animated: \(animated))")
}
func sideMenuWillDisappear(menu: UISideMenuNavigationController, animated: Bool) {
func sideMenuWillDisappear(menu: SideMenuNavigationController, animated: Bool) {
print("SideMenu Disappearing! (animated: \(animated))")
}
func sideMenuDidDisappear(menu: UISideMenuNavigationController, animated: Bool) {
func sideMenuDidDisappear(menu: SideMenuNavigationController, animated: Bool) {
print("SideMenu Disappeared! (animated: \(animated))")
}
}
```
*Note: setting the `sideMenuDelegate` property on `UISideMenuNavigationController` is optional. If your view controller adheres to the protocol then the methods will be called automatically.*
*Note: setting the `sideMenuDelegate` property on `SideMenuNavigationController` is optional. If your view controller adheres to the protocol then the methods will be called automatically.*
### Advanced
<details>
<summary>Click for Details</summary>
@@ -309,9 +309,9 @@ For simplicity, `SideMenuManager.default` serves as the primary instance as most
let customSideMenuManager = SideMenuManager()
```
2. Setup and display menus with your custom instance the same as you would with the `SideMenuManager.default` instance.
3. If using Storyboards, subclass your instance of `UISideMenuNavigationController` and set its `sideMenuManager` property to your custom instance. This must be done before `viewDidLoad` is called:
3. If using Storyboards, subclass your instance of `SideMenuNavigationController` and set its `sideMenuManager` property to your custom instance. This must be done before `viewDidLoad` is called:
``` swift
class MySideMenuNavigationController: UISideMenuNavigationController {
class MySideMenuNavigationController: SideMenuNavigationController {
let customSideMenuManager = SideMenuManager()
@@ -322,10 +322,10 @@ class MySideMenuNavigationController: UISideMenuNavigationController {
}
}
```
Alternatively, you can set `sideMenuManager` from the view controller that segues to your UISideMenuNavigationController:
Alternatively, you can set `sideMenuManager` from the view controller that segues to your SideMenuNavigationController:
``` swift
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let sideMenuNavigationController = segue.destination as? UISideMenuNavigationController {
if let sideMenuNavigationController = segue.destination as? SideMenuNavigationController {
sideMenuNavigationController.sideMenuManager = customSideMenuManager
}
}
+1 -1
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "SideMenu"
s.version = "6.2.0"
s.version = "6.2.1"
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.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 135 KiB