Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17b8fcd413 | |||
| 64f9d0bfbd | |||
| 8dde1951c3 | |||
| 7d15070513 | |||
| b76a39208e | |||
| 2c496c3c56 | |||
| 37071b5d06 | |||
| 607260ac2e |
@@ -57,7 +57,14 @@ internal extension UIViewController {
|
||||
// View controller being displayed on screen to the user.
|
||||
var topMostViewController: UIViewController {
|
||||
let activeViewController = self.activeViewController
|
||||
return activeViewController.presentingViewController?.topMostViewController ?? activeViewController
|
||||
return activeViewController.presentedViewController?.topMostViewController ?? activeViewController
|
||||
}
|
||||
|
||||
var containerViewController: UIViewController {
|
||||
return navigationController?.containerViewController ??
|
||||
tabBarController?.containerViewController ??
|
||||
splitViewController?.containerViewController ??
|
||||
self
|
||||
}
|
||||
|
||||
@objc var isHidden: Bool {
|
||||
|
||||
@@ -30,6 +30,7 @@ internal final class SideMenuPresentationController {
|
||||
private let config: PresentationModel
|
||||
private unowned var containerView: UIView
|
||||
private var interactivePopGestureRecognizerEnabled: Bool?
|
||||
private var clipsToBounds: Bool?
|
||||
private let leftSide: Bool
|
||||
private weak var originalSuperview: UIView?
|
||||
private unowned var presentedViewController: UIViewController
|
||||
@@ -190,9 +191,7 @@ internal final class SideMenuPresentationController {
|
||||
statusBarView?.removeFromSuperview()
|
||||
presentedViewController.view.removeFromSuperview()
|
||||
|
||||
presentingViewController.view.motionEffects.removeAll()
|
||||
presentingViewController.view.layer.shadowOpacity = 0
|
||||
presentedViewController.view.layer.shadowOpacity = 0
|
||||
removeStyles(from: presentingViewController.containerViewController.view)
|
||||
|
||||
if let interactivePopGestureRecognizerEnabled = interactivePopGestureRecognizerEnabled,
|
||||
let topNavigationController = presentingViewController as? UINavigationController {
|
||||
@@ -240,6 +239,8 @@ private extension SideMenuPresentationController {
|
||||
view.layer.shadowRadius = config.presentationStyle.onTopShadowRadius
|
||||
view.layer.shadowOpacity = config.presentationStyle.onTopShadowOpacity
|
||||
view.layer.shadowOffset = config.presentationStyle.onTopShadowOffset
|
||||
clipsToBounds = clipsToBounds ?? view.clipsToBounds
|
||||
view.clipsToBounds = false
|
||||
}
|
||||
|
||||
func addParallax(to view: UIView) {
|
||||
@@ -268,4 +269,12 @@ private extension SideMenuPresentationController {
|
||||
view.addMotionEffect(group)
|
||||
}
|
||||
}
|
||||
|
||||
func removeStyles(from view: UIView) {
|
||||
view.motionEffects.removeAll()
|
||||
view.layer.shadowOpacity = 0
|
||||
view.layer.shadowOpacity = 0
|
||||
view.clipsToBounds = clipsToBounds ?? true
|
||||
clipsToBounds = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,46 +10,46 @@ import UIKit
|
||||
@objcMembers
|
||||
open class SideMenuPresentationStyle: InitializableClass {
|
||||
/// Background color behind the views and status bar color
|
||||
public var backgroundColor: UIColor = .black
|
||||
open var backgroundColor: UIColor = .black
|
||||
/// The starting alpha value of the menu before it appears
|
||||
public var menuStartAlpha: CGFloat = 1
|
||||
open var menuStartAlpha: CGFloat = 1
|
||||
/// Whether or not the menu is on top. If false, the presenting view is on top. Shadows are applied to the view on top.
|
||||
public var menuOnTop: Bool = false
|
||||
open var menuOnTop: Bool = false
|
||||
/// The amount the menu is translated along the x-axis. Zero is stationary, negative values are off-screen, positive values are on screen.
|
||||
public var menuTranslateFactor: CGFloat = 0
|
||||
open var menuTranslateFactor: CGFloat = 0
|
||||
/// The amount the menu is scaled. Less than one shrinks the view, larger than one grows the view.
|
||||
public var menuScaleFactor: CGFloat = 1
|
||||
open var menuScaleFactor: CGFloat = 1
|
||||
/// The color of the shadow applied to the top most view.
|
||||
public var onTopShadowColor: UIColor = .black
|
||||
open var onTopShadowColor: UIColor = .black
|
||||
/// The radius of the shadow applied to the top most view.
|
||||
public var onTopShadowRadius: CGFloat = 5
|
||||
open var onTopShadowRadius: CGFloat = 5
|
||||
/// The opacity of the shadow applied to the top most view.
|
||||
public var onTopShadowOpacity: Float = 0
|
||||
open var onTopShadowOpacity: Float = 0
|
||||
/// The offset of the shadow applied to the top most view.
|
||||
public var onTopShadowOffset: CGSize = .zero
|
||||
open var onTopShadowOffset: CGSize = .zero
|
||||
/// The ending alpha of the presenting view when the menu is fully displayed.
|
||||
public var presentingEndAlpha: CGFloat = 1
|
||||
open var presentingEndAlpha: CGFloat = 1
|
||||
/// The amount the presenting view is translated along the x-axis. Zero is stationary, negative values are off-screen, positive values are on screen.
|
||||
public var presentingTranslateFactor: CGFloat = 0
|
||||
open var presentingTranslateFactor: CGFloat = 0
|
||||
/// The amount the presenting view is scaled. Less than one shrinks the view, larger than one grows the view.
|
||||
public var presentingScaleFactor: CGFloat = 1
|
||||
open var presentingScaleFactor: CGFloat = 1
|
||||
/// The strength of the parallax effect on the presenting view once the menu is displayed.
|
||||
public var presentingParallaxStrength: CGSize = .zero
|
||||
open var presentingParallaxStrength: CGSize = .zero
|
||||
|
||||
required public init() {}
|
||||
|
||||
/// This method is called just before the presentation transition begins. Use this to setup any animations. The super method does not need to be called.
|
||||
func presentationTransitionWillBegin(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
|
||||
open func presentationTransitionWillBegin(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
|
||||
/// This method is called during the presentation animation. Use this to animate anything alongside the menu animation. The super method does not need to be called.
|
||||
func presentationTransition(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
|
||||
open func presentationTransition(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
|
||||
/// This method is called when the presentation transition ends. Use this to finish any animations. The super method does not need to be called.
|
||||
func presentationTransitionDidEnd(to presentedViewController: UIViewController, from presentingViewController: UIViewController, _ completed: Bool) {}
|
||||
open func presentationTransitionDidEnd(to presentedViewController: UIViewController, from presentingViewController: UIViewController, _ completed: Bool) {}
|
||||
/// This method is called just before the dismissal transition begins. Use this to setup any animations. The super method does not need to be called.
|
||||
func dismissalTransitionWillBegin(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
|
||||
open func dismissalTransitionWillBegin(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
|
||||
/// This method is called during the dismissal animation. Use this to animate anything alongside the menu animation. The super method does not need to be called.
|
||||
func dismissalTransition(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
|
||||
open func dismissalTransition(to presentedViewController: UIViewController, from presentingViewController: UIViewController) {}
|
||||
/// This method is called when the dismissal transition ends. Use this to finish any animations. The super method does not need to be called.
|
||||
func dismissalTransitionDidEnd(to presentedViewController: UIViewController, from presentingViewController: UIViewController, _ completed: Bool) {}
|
||||
open func dismissalTransitionDidEnd(to presentedViewController: UIViewController, from presentingViewController: UIViewController, _ completed: Bool) {}
|
||||
}
|
||||
|
||||
public extension SideMenuPresentationStyle {
|
||||
|
||||
@@ -51,7 +51,7 @@ Check out the example project to see it in action!
|
||||
|  |  |  |  |
|
||||
|
||||
## Requirements
|
||||
- [x] Xcode 10.
|
||||
- [x] Xcode 11.
|
||||
- [x] Swift 5.
|
||||
- [x] iOS 10 or higher.
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SideMenu"
|
||||
s.version = "6.4.0"
|
||||
s.version = "6.4.3"
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user