Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arturdev committed May 18, 2020
1 parent 91d917a commit cb2eac5
Show file tree
Hide file tree
Showing 10 changed files with 328 additions and 263 deletions.
4 changes: 2 additions & 2 deletions AMSlideMenu.podspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Pod::Spec.new do |s|
s.name = "AMSlideMenu"
s.version = "2.0.2"
s.version = "2.0.3"
s.swift_version = '5.1'
s.summary = "Easy slide menu with high customization for ios"
s.platform = :ios, '10.0'
s.source = { :git => "https://github.com/arturdev/AMSlideMenu.git", :tag => "2.0.1" }
s.source = { :git => "https://github.com/arturdev/AMSlideMenu2.git", :tag => "2.0.3" }
s.social_media_url = 'https://www.linkedin.com/in/arturdev/'
s.description = <<-DESC
This is a simple library to create sliding menus that can be used in storyboards.
Expand Down
20 changes: 8 additions & 12 deletions AMSlideMenu/AMSlideMenuMainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ open class AMSlideMenuMainViewController: UIViewController {

private var menuWidthDefaultMultiplier: CGFloat {
#if targetEnvironment(macCatalyst)
return 0.2
return 0.201
#else
return 0.8
return 0.801
#endif
}
open var leftMenuWidth: CGFloat = 0
open var rightMenuWidth: CGFloat = 0
@IBInspectable open var leftMenuWidth: CGFloat = 0
@IBInspectable open var rightMenuWidth: CGFloat = 0

open var animationDuration = TimeInterval(0.25)
open var animationOptions: AMSlidingAnimationOptions = [.slidingMenu, .dimmedBackground, .menuShadow, .blurBackground]
Expand Down Expand Up @@ -139,7 +139,7 @@ open class AMSlideMenuMainViewController: UIViewController {
view.backgroundColor = .clear
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.isUserInteractionEnabled = false
view.layer.zPosition = CGFloat(Float.greatestFiniteMagnitude) - 1
view.layer.zPosition = CGFloat(Float.greatestFiniteMagnitude)
view.tag = 1000
return view
}()
Expand Down Expand Up @@ -202,17 +202,13 @@ open class AMSlideMenuMainViewController: UIViewController {
let shouldUpdateRightMenuWidth = rightMenuWidth == view.bounds.width * menuWidthDefaultMultiplier
super.viewWillTransition(to: size, with: coordinator)

coordinator.animate(alongsideTransition: { (_) in
let updateBlock = { (_: Any) in
shouldUpdateLeftMenuWidth ? (self.leftMenuWidth = (UIWindow.keyWindow?.width ?? 0) * self.menuWidthDefaultMultiplier) : nil
shouldUpdateRightMenuWidth ? (self.rightMenuWidth = (UIWindow.keyWindow?.width ?? 0) * self.menuWidthDefaultMultiplier) : nil
self.updateLeftMenuFrame()
self.updateRightMenuFrame()
}) { (_) in
shouldUpdateLeftMenuWidth ? (self.leftMenuWidth = size.width * self.menuWidthDefaultMultiplier) : nil
shouldUpdateRightMenuWidth ? (self.rightMenuWidth = size.width * self.menuWidthDefaultMultiplier) : nil
self.updateLeftMenuFrame()
self.updateRightMenuFrame()
}
coordinator.animate(alongsideTransition: updateBlock, completion: updateBlock)
}

@objc open override func showLeftMenu(animated: Bool, completion handler: (()->Void)? = nil) {
Expand Down Expand Up @@ -502,7 +498,7 @@ extension AMSlideMenuMainViewController: UIGestureRecognizerDelegate {
return true
}

let point = pan.location(in: pan.view)
let point = pan.location(in: contentView)

if velocity.x > 0 {
if let rightMenuFrame = rightMenuVC?.view.layer.presentation()?.frame, rightMenuFrame.origin.x < contentView.bounds.width {
Expand Down
10 changes: 8 additions & 2 deletions AMSlideMenu/Animation/Animators/AMSlidingFixedMenuAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ open class AMSlidingFixedMenuAnimator: AMSlidingAnimatorProtocol {
leftMenuView.frame = frame
completion?()
if prg == 0 {
leftMenuView.isHidden = true
frame.origin.x = -frame.width
leftMenuView.frame = frame

DispatchQueue.main.asyncAfter(deadline: .now() + duration) {
leftMenuView.isHidden = true
}
}
}

Expand All @@ -62,9 +65,12 @@ open class AMSlidingFixedMenuAnimator: AMSlidingAnimatorProtocol {
rightMenuView.frame = frame
completion?()
if prg == 0 {
rightMenuView.isHidden = true
frame.origin.x = contentFrame.width
rightMenuView.frame = frame

DispatchQueue.main.asyncAfter(deadline: .now() + duration) {
rightMenuView.isHidden = true
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 51;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -48,7 +48,6 @@
36574E0ACB44A0D0B52ED66C /* Pods-AMSlideMenuExample.debug.xcconfig */,
86E97BFC3B34AA8F0C4AC93B /* Pods-AMSlideMenuExample.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -357,7 +356,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = U8CSJE9SQ2;
INFOPLIST_FILE = AMSlideMenuExample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -377,7 +376,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = U8CSJE9SQ2;
INFOPLIST_FILE = AMSlideMenuExample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
73 changes: 68 additions & 5 deletions AMSlideMenuExample/AMSlideMenuExample/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,24 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="koa-PY-TSG">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="VAy-Pg-ubr">
<objects>
<viewController id="P9g-Hd-H5r" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="BQu-aN-Wb9">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemOrangeColor" red="1" green="0.58431372550000005" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="NXg-7n-M5V"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="W3B-0k-hS9" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-765" y="-236"/>
</scene>
<!--Slide Menu Main View Controller-->
<scene sceneID="m4L-AK-kcM">
<objects>
<viewController id="koa-PY-TSG" customClass="AMSlideMenuMainViewController" customModule="AMSlideMenu" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Q8c-s2-elj">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="0Ug-jr-lbL"/>
</view>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="leftMenuSegueName" value="leftMenu"/>
<userDefinedRuntimeAttribute type="string" keyPath="rightMenuSegueName" value="rightMenu"/>
<userDefinedRuntimeAttribute type="string" keyPath="contentSegueName" value="content"/>
<userDefinedRuntimeAttribute type="number" keyPath="leftMenuWidth">
<real key="value" value="200"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="rightMenuWidth">
<real key="value" value="300"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<segue destination="BYZ-38-t0r" kind="custom" identifier="content" customClass="AMContentSegue" customModule="AMSlideMenu" id="4cs-5I-f2c"/>
<segue destination="P9g-Hd-H5r" kind="custom" identifier="leftMenu" customClass="AMLeftMenuSegue" customModule="AMSlideMenu" id="sA8-NG-F1t"/>
<segue destination="Xls-y1-ZfN" kind="custom" identifier="rightMenu" customClass="AMRightMenuSegue" customModule="AMSlideMenu" id="I2W-4g-C8r"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ctl-Wi-dGR" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1541" y="138"/>
</scene>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="AMSlideMenuExample" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<color key="backgroundColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="139" y="138"/>
</scene>
<!--View Controller-->
<scene sceneID="KwO-jQ-sLz">
<objects>
<viewController id="Xls-y1-ZfN" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="tTa-Nn-WuW">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemPinkColor" red="1" green="0.1764705882" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="2fF-yg-z1i"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="AG8-R9-hwC" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-765" y="526"/>
</scene>
</scenes>
</document>
4 changes: 2 additions & 2 deletions AMSlideMenuExample/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- AMSlideMenu (2.0.0)
- AMSlideMenu (2.0.2)

DEPENDENCIES:
- AMSlideMenu (from `../`)
Expand All @@ -9,7 +9,7 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
AMSlideMenu: f691cfee1596c24258f2f96f57564fa5b5aa69a3
AMSlideMenu: 50139e20a2c41fd7787ed96cc5f560ffde469fef

PODFILE CHECKSUM: c1e7c5ded39e84d083dd8f35a8d14dce1343f062

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions AMSlideMenuExample/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cb2eac5

Please sign in to comment.