Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Fix/status bar change #176

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.teodorpatras.sidemenucontroller.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -421,7 +421,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.teodorpatras.sidemenucontroller.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
10 changes: 6 additions & 4 deletions SideMenuController.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -363,6 +364,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -387,7 +389,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -407,7 +409,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.teodorpatras.SideMenuController;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -418,7 +420,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.teodorpatras.SideMenuControllerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -429,7 +431,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.teodorpatras.SideMenuControllerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
10 changes: 5 additions & 5 deletions Source/SideMenuController+SideOver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension SideMenuController {
}
}

func handleSidePanelPan(_ recognizer: UIPanGestureRecognizer){
@objc func handleSidePanelPan(_ recognizer: UIPanGestureRecognizer){

guard canDisplaySideController else {
return
Expand Down Expand Up @@ -141,20 +141,20 @@ extension SideMenuController {
self.centerPanelOverlay.alpha = alpha
self.set(statusUnderlayAlpha: alpha)
self.sidePanel.frame = destinationFrame
}, completion: { _ in
}, completion: {
completion?(updated)
})
}

func handleLeftSwipe(){
@objc func handleLeftSwipe(){
handleHorizontalSwipe(toLeft: true)
}

func handleRightSwipe(){
@objc func handleRightSwipe(){
handleHorizontalSwipe(toLeft: false)
}

func handleHorizontalSwipe(toLeft left: Bool) {
@objc func handleHorizontalSwipe(toLeft left: Bool) {
if (left && sidePanelPosition.isPositionedLeft) ||
(!left && !sidePanelPosition.isPositionedLeft) {
if sidePanelVisible {
Expand Down
10 changes: 5 additions & 5 deletions Source/SideMenuController+SideUnder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ extension SideMenuController {
centerPanel.addGestureRecognizer(tapRecognizer)
}

@inline(__always) func handleCenterPanelPanLeft(_ gesture: UIScreenEdgePanGestureRecognizer) {
@objc @inline(__always) func handleCenterPanelPanLeft(_ gesture: UIScreenEdgePanGestureRecognizer) {
handleCenterPanelPan(gesture)
}

@inline(__always) func handleCenterPanelPanRight(_ gesture: UIScreenEdgePanGestureRecognizer) {
@objc @inline(__always) func handleCenterPanelPanRight(_ gesture: UIScreenEdgePanGestureRecognizer) {
handleCenterPanelPan(gesture)
}

Expand Down Expand Up @@ -92,18 +92,18 @@ extension SideMenuController {

let updated = centerPanel.frame != centerPanelFrame

UIView.panelAnimation( duration, animations: { _ in
UIView.panelAnimation( duration, animations: {
self.centerPanel.frame = centerPanelFrame
self.set(statusUnderlayAlpha: hidden ? 0 : 1)
}) { _ in
}) {
if hidden {
self.setSideShadow(hidden: hidden)
}
completion?(updated)
}
}

func handleCenterPanelPan(_ recognizer: UIPanGestureRecognizer){
@objc func handleCenterPanelPan(_ recognizer: UIPanGestureRecognizer){

guard canDisplaySideController else {
return
Expand Down
22 changes: 15 additions & 7 deletions Source/SideMenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public extension SideMenuController {
/**
Toggles the side pannel visible or not.
*/
public func toggle() {
@objc public func toggle() {

if !transitionInProgress {
if !sidePanelVisible {
Expand Down Expand Up @@ -213,7 +213,7 @@ open class SideMenuController: UIViewController, UIGestureRecognizerDelegate {

// MARK: - Configurations -

func repositionViews() {
@objc func repositionViews() {

if sidePanelVisible {
toggle()
Expand Down Expand Up @@ -356,7 +356,7 @@ open class SideMenuController: UIViewController, UIGestureRecognizerDelegate {
statusBarUnderlay.alpha = alpha
}

func handleTap() {
@objc func handleTap() {
animate(toReveal: false)
}

Expand Down Expand Up @@ -398,7 +398,15 @@ open class SideMenuController: UIViewController, UIGestureRecognizerDelegate {
let b = "Bar"
let w = "Window"

return UIApplication.shared.value(forKey: s+b+w) as? UIWindow
if #available(iOS 13.0, *) {
let statusBar = UIView(frame: UIApplication.shared.keyWindow?.windowScene?.statusBarManager?.statusBarFrame ?? CGRect.zero)
UIApplication.shared.keyWindow?.addSubview(statusBar)
return statusBar as? UIWindow
} else {
return UIApplication.shared.value(forKey: s+b+w) as? UIWindow
// Fallback on earlier versions
}

}

fileprivate var showsStatusUnderlay: Bool {
Expand Down Expand Up @@ -448,12 +456,12 @@ open class SideMenuController: UIViewController, UIGestureRecognizerDelegate {

if sidePanelPosition.isPositionedUnder {
sidePanelFrame = CGRect(x: sidePanelPosition.isPositionedLeft ? 0 :
screenSize.width - panelWidth, y: statusBarHeight, width: panelWidth, height: screenSize.height - statusBarHeight)
screenSize.width - panelWidth, y: 0, width: panelWidth, height: screenSize.height)
} else {
if sidePanelVisible {
sidePanelFrame = CGRect(x: sidePanelPosition.isPositionedLeft ? 0 : screenSize.width - panelWidth, y: statusBarHeight, width: panelWidth, height: screenSize.height - statusBarHeight)
sidePanelFrame = CGRect(x: sidePanelPosition.isPositionedLeft ? 0 : screenSize.width - panelWidth, y: 0, width: panelWidth, height: screenSize.height)
} else {
sidePanelFrame = CGRect(x: sidePanelPosition.isPositionedLeft ? -panelWidth : screenSize.width, y: statusBarHeight, width: panelWidth, height: screenSize.height - statusBarHeight)
sidePanelFrame = CGRect(x: sidePanelPosition.isPositionedLeft ? -panelWidth : screenSize.width, y: 0, width: panelWidth, height: screenSize.height)
}
}

Expand Down