Compare commits

..

10 Commits

Author SHA1 Message Date
jonkykong 082813937e Updated podspec 2019-10-10 21:13:00 -07:00
jonkykong 538e84a26d Updated tests 2019-10-10 21:10:55 -07:00
jonkykong 17b8fcd413 Updated podspec 2019-09-29 13:06:08 -07:00
jonkykong 64f9d0bfbd Bug fix 2019-09-29 13:05:56 -07:00
jonkykong 8dde1951c3 Updated podspec 2019-09-26 01:16:30 -07:00
jonkykong 7d15070513 Scope adjustment 2019-09-26 01:16:14 -07:00
jonkykong b76a39208e Merge branch 'master' of https://github.com/jonkykong/SideMenu
* 'master' of https://github.com/jonkykong/SideMenu:
  Update README.md
2019-09-26 01:15:54 -07:00
Jon Kent 2c496c3c56 Update README.md 2019-09-25 02:17:29 -07:00
jonkykong 37071b5d06 Updated podspec 2019-09-24 22:38:42 -07:00
jonkykong 607260ac2e Fix for view controller views now being clipped causing shadows not to work. 2019-09-24 22:38:27 -07:00
6 changed files with 46 additions and 34 deletions
+5 -9
View File
@@ -17,9 +17,6 @@ class ExampleTests: XCTestCase {
private var mainViewController: XCUIElement {
return app.navigationBars[swipeHere]
}
private var mainViewControllerNavigation: XCUIElement {
return mainViewController.otherElements[swipeHere]
}
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
@@ -55,19 +52,18 @@ class ExampleTests: XCTestCase {
mainViewController.buttons["Right Menu"].tap()
app.tables/*@START_MENU_TOKEN@*/.staticTexts["Present View Controller 1"]/*[[".cells.staticTexts[\"Present View Controller 1\"]",".staticTexts[\"Present View Controller 1\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.tap()
app.buttons["Dismiss"].tap()
mainViewController.tap()
validate()
}
}
func testSwiping() {
mainViewControllerNavigation.swipeRight()
let element = app.children(matching: .window).element(boundBy: 0).children(matching: .other).element
element.swipeLeft()
mainViewController.swipeRight()
mainViewController.swipeLeft()
validate()
element.swipeLeft()
mainViewControllerNavigation.swipeLeft()
element.swipeRight()
mainViewController.swipeLeft()
mainViewController.swipeRight()
validate()
}
+8 -1
View File
@@ -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
}
}
+19 -19
View File
@@ -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 {
+1 -1
View File
@@ -51,7 +51,7 @@ Check out the example project to see it in action!
| ![](https://raw.githubusercontent.com/jonkykong/SideMenu/master/etc/SlideOut.gif) | ![](https://raw.githubusercontent.com/jonkykong/SideMenu/master/etc/SlideIn.gif) | ![](https://raw.githubusercontent.com/jonkykong/SideMenu/master/etc/Dissolve.gif) | ![](https://raw.githubusercontent.com/jonkykong/SideMenu/master/etc/InOut.gif) |
## Requirements
- [x] Xcode 10.
- [x] Xcode 11.
- [x] Swift 5.
- [x] iOS 10 or higher.
+1 -1
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "SideMenu"
s.version = "6.4.0"
s.version = "6.4.4"
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.