From 71ea9866e11da230642cba76922f41f2414bfb26 Mon Sep 17 00:00:00 2001 From: thbyssmobi <131761689+thbyssmobi@users.noreply.github.com> Date: Thu, 27 Apr 2023 11:57:40 +0200 Subject: [PATCH 1/9] Update ContainerController.swift --- Sources/ContainerController/ContainerController.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Sources/ContainerController/ContainerController.swift b/Sources/ContainerController/ContainerController.swift index c857554..820a966 100644 --- a/Sources/ContainerController/ContainerController.swift +++ b/Sources/ContainerController/ContainerController.swift @@ -108,7 +108,7 @@ open class ContainerController: NSObject { // MARK: - Positions Move - private var positionTop: CGFloat { + public var positionTop: CGFloat { var top = layout.positions.top if !isPortrait { if let landscape = layout.landscapePositions { @@ -128,7 +128,7 @@ open class ContainerController: NSObject { return deviceHeight - middle } - private var positionBottom: CGFloat { + public var positionBottom: CGFloat { var bottom = layout.positions.bottom if !isPortrait { if let landscape = layout.landscapePositions { @@ -178,7 +178,7 @@ open class ContainerController: NSObject { self.controller = controller set(layout: layout) - NotificationCenter.default.addObserver(self, selector: #selector(rotated), name: UIDevice.orientationDidChangeNotification, object: nil) +// NotificationCenter.default.addObserver(self, selector: #selector(rotated), name: UIDevice.orientationDidChangeNotification, object: nil) createShadowButton() createContainerView() @@ -448,6 +448,11 @@ open class ContainerController: NSObject { } view.contentView?.addSubview(scrollView) + scrollView.translatesAutoresizingMaskIntoConstraints = false + scrollView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true + scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true + scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true + scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true calculationViews() } From b36b7a0a8d2a506261015d3f086b26b6badf0113 Mon Sep 17 00:00:00 2001 From: thbyssmobi <131761689+thbyssmobi@users.noreply.github.com> Date: Thu, 27 Apr 2023 12:05:51 +0200 Subject: [PATCH 2/9] Update ContainerControllerDelegate.swift --- .../ContainerController/ContainerControllerDelegate.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/ContainerController/ContainerControllerDelegate.swift b/Sources/ContainerController/ContainerControllerDelegate.swift index 8391e34..0611824 100644 --- a/Sources/ContainerController/ContainerControllerDelegate.swift +++ b/Sources/ContainerController/ContainerControllerDelegate.swift @@ -20,6 +20,8 @@ public protocol ContainerControllerDelegate { /// Reports the changes current position of the container, after its use func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) + func hideMenu(position: Double) + } @available(iOS 13.0, *) @@ -33,6 +35,9 @@ public extension ContainerControllerDelegate { } func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) { + + hideMenu(position: position) + } } From 0a0a22abf2bfd2eb6afc13f0e76d3ae194f829a9 Mon Sep 17 00:00:00 2001 From: thbyssmobi <131761689+thbyssmobi@users.noreply.github.com> Date: Thu, 23 Nov 2023 13:45:13 +0100 Subject: [PATCH 3/9] Update ContainerController.swift Changed gesture recognizer. --- .../ContainerController.swift | 41 ++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/Sources/ContainerController/ContainerController.swift b/Sources/ContainerController/ContainerController.swift index 820a966..5aa2b0b 100644 --- a/Sources/ContainerController/ContainerController.swift +++ b/Sources/ContainerController/ContainerController.swift @@ -448,14 +448,29 @@ open class ContainerController: NSObject { } view.contentView?.addSubview(scrollView) - scrollView.translatesAutoresizingMaskIntoConstraints = false - scrollView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true - scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true - scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true - scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true +// scrollView.translatesAutoresizingMaskIntoConstraints = false +// scrollView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true +// scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true +// scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true +// scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true calculationViews() + + self.addRecognizerToScrollView(scrollView: scrollView) + } + + func addRecognizerToScrollView(scrollView: UIScrollView) { + if let panGesture = panGesture { + print("didScroll addRecognizer") + scrollView.addGestureRecognizer(panGesture) + } } + func removeRecognizerToScrollView(scrollView: UIScrollView) { + if let panGesture = panGesture { + print("didScroll removeRecognizer") + scrollView.removeGestureRecognizer(panGesture) + } + } // MARK: - Pan Gesture @objc private func handlePan(_ gesture: UIPanGestureRecognizer) { @@ -501,6 +516,14 @@ open class ContainerController: NSObject { move(type: type, animation: true, velocity: velocityY, from: .pan) + if type == .top && scrollView?.contentSize.height ?? 0.0 > (UIScreen.main.bounds.height * 0.95) { + + if let scrollView = self.scrollView { + self.removeRecognizerToScrollView(scrollView: scrollView) + + } + } + default: break } } @@ -1271,6 +1294,10 @@ extension ContainerController: UIScrollViewDelegate { let from: ContainerFromType = .scrollBorder let animation = false + print("didScroll a \(position) \(type)") + + self.addRecognizerToScrollView(scrollView: scrollView) + shadowLevelAlpha(position: position, animation: false) changeFooterView(position: position) calculationScrollViewHeight(from: from) @@ -1306,12 +1333,16 @@ extension ContainerController: UIScrollViewDelegate { let from: ContainerFromType = .scroll let animation = false + print("didScroll b \(position) \(type)") + changeView(transform: scrollTransform) shadowLevelAlpha(position: position, animation: false) changeFooterView(position: position) calculationScrollViewHeight(from: from) changeMove(position: position, type: type, animation: animation) } + } else { + print("didScroll false") } } } From 0f33116ec992e55c3930133df313d5b820d32619 Mon Sep 17 00:00:00 2001 From: thbyssmobi <131761689+thbyssmobi@users.noreply.github.com> Date: Thu, 17 Oct 2024 14:55:03 +0200 Subject: [PATCH 4/9] Update ContainerDevice.swift --- .../ContainerController/ContainerDevice.swift | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/Sources/ContainerController/ContainerDevice.swift b/Sources/ContainerController/ContainerDevice.swift index 7738823..e916ede 100644 --- a/Sources/ContainerController/ContainerDevice.swift +++ b/Sources/ContainerController/ContainerDevice.swift @@ -71,25 +71,7 @@ open class ContainerDevice { // MARK: - Orientation class public var isPortrait: Bool { - - var portrait: Bool = false - - let size: CGSize = UIScreen.main.bounds.size - if size.width / size.height > 1 { - portrait = false - } else { - portrait = true - } - - switch UIDevice.current.orientation { - case .landscapeLeft, .landscapeRight: - portrait = false - case .portrait: - portrait = true - default: break - } - - return portrait + return true } class var statusBarOrientation: UIInterfaceOrientation? { From db2e8e21038090695ef7f79aad09e00d010e6167 Mon Sep 17 00:00:00 2001 From: thbyssmobi <131761689+thbyssmobi@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:32:00 +0100 Subject: [PATCH 5/9] Update ContainerLayout.swift --- Sources/ContainerController/ContainerLayout.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/ContainerController/ContainerLayout.swift b/Sources/ContainerController/ContainerLayout.swift index 63e3de8..0b0f6c5 100644 --- a/Sources/ContainerController/ContainerLayout.swift +++ b/Sources/ContainerController/ContainerLayout.swift @@ -20,10 +20,13 @@ open class ContainerPosition { static let zero = ContainerPosition(top: 0, bottom: 0) - public init(top: CGFloat, middle: CGFloat? = nil, bottom: CGFloat) { + public var custom: CGFloat? + + public init(top: CGFloat, middle: CGFloat? = nil, bottom: CGFloat, custom: CGFloat? = nil) { self.top = top self.middle = middle self.bottom = bottom + self.custom = custom } } From 912044f6948f3480aae9dc91ca73ede389717c1d Mon Sep 17 00:00:00 2001 From: thbyssmobi <131761689+thbyssmobi@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:33:34 +0100 Subject: [PATCH 6/9] Update ContainerController.swift --- .../ContainerController/ContainerController.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Sources/ContainerController/ContainerController.swift b/Sources/ContainerController/ContainerController.swift index 5aa2b0b..fa93e4d 100644 --- a/Sources/ContainerController/ContainerController.swift +++ b/Sources/ContainerController/ContainerController.swift @@ -127,6 +127,16 @@ open class ContainerController: NSObject { } return deviceHeight - middle } + + public var positionCustom: CGFloat { + var custom = layout.positions.custom ?? layout.positions.bottom + if !isPortrait { + if let landscape = layout.landscapePositions { + custom = landscape.custom ?? 0.0 + } + } + return deviceHeight - custom + } public var positionBottom: CGFloat { var bottom = layout.positions.bottom @@ -784,7 +794,7 @@ open class ContainerController: NSObject { else { return positionMiddle } case .bottom: return positionBottom case .hide: return deviceHeight - case .custom: return 0.0 + case .custom: return positionCustom } } From 745a87118d7ed2c9c063360f6e6e9299a504bebf Mon Sep 17 00:00:00 2001 From: thbyssmobi <131761689+thbyssmobi@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:48:11 +0200 Subject: [PATCH 7/9] Update ContainerController.swift --- .../ContainerController.swift | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Sources/ContainerController/ContainerController.swift b/Sources/ContainerController/ContainerController.swift index fa93e4d..b491444 100644 --- a/Sources/ContainerController/ContainerController.swift +++ b/Sources/ContainerController/ContainerController.swift @@ -109,13 +109,22 @@ open class ContainerController: NSObject { // MARK: - Positions Move public var positionTop: CGFloat { - var top = layout.positions.top - if !isPortrait { - if let landscape = layout.landscapePositions { - top = landscape.top + if let top = layout.positions.top { + if !isPortrait { + if let landscapeTop = layout.landscapePositions?.top { + return landscapeTop + } else { + return top + } + } else { + return top } + } else { + + let bottomPosition = layout.positions.bottom + + return deviceHeight - bottomPosition } - return top } public var positionMiddle: CGFloat { From c34602c79b3255b9db68fde7115ac43bb6f0d7ba Mon Sep 17 00:00:00 2001 From: thbyssmobi <131761689+thbyssmobi@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:48:47 +0200 Subject: [PATCH 8/9] Update ContainerLayout.swift --- Sources/ContainerController/ContainerLayout.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/ContainerController/ContainerLayout.swift b/Sources/ContainerController/ContainerLayout.swift index 0b0f6c5..563c1c8 100644 --- a/Sources/ContainerController/ContainerLayout.swift +++ b/Sources/ContainerController/ContainerLayout.swift @@ -12,7 +12,7 @@ import UIKit open class ContainerPosition { - public var top: CGFloat + public var top: CGFloat? public var middle: CGFloat? @@ -22,7 +22,7 @@ open class ContainerPosition { public var custom: CGFloat? - public init(top: CGFloat, middle: CGFloat? = nil, bottom: CGFloat, custom: CGFloat? = nil) { + public init(top: CGFloat? = nil, middle: CGFloat? = nil, bottom: CGFloat, custom: CGFloat? = nil) { self.top = top self.middle = middle self.bottom = bottom From 8c57dfd4ddd17884c44d2937c284e483da6ba3d8 Mon Sep 17 00:00:00 2001 From: thbyssmobi <131761689+thbyssmobi@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:49:33 +0200 Subject: [PATCH 9/9] Update ContainerView.swift --- .../ContainerController/ContainerView.swift | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Sources/ContainerController/ContainerView.swift b/Sources/ContainerController/ContainerView.swift index c5b00dd..84c9144 100644 --- a/Sources/ContainerController/ContainerView.swift +++ b/Sources/ContainerController/ContainerView.swift @@ -68,13 +68,25 @@ open class ContainerView: UIView { public func addBlur(style: UIBlurEffect.Style) { if visualEffectView == nil { - let blurView = UIVisualEffectView(effect: UIBlurEffect(style: style)) - self.insertSubview(blurView, at: 0) - visualEffectView = blurView + if #available(iOS 26.0, *) { + let glassEffect = UIGlassEffect(style: .regular) + + let blurView = UIVisualEffectView(effect: glassEffect) + self.insertSubview(blurView, at: 0) + visualEffectView = blurView + } else { + let blurView = UIVisualEffectView(effect: UIBlurEffect(style: style)) + self.insertSubview(blurView, at: 0) + visualEffectView = blurView + } } guard let visualEffectView = visualEffectView else { return } - visualEffectView.effect = UIBlurEffect(style: style) + if #available(iOS 26.0, *) { + visualEffectView.effect = UIGlassEffect(style: .regular) + } else { + visualEffectView.effect = UIBlurEffect(style: style) + } visualEffectView.bounds = bounds visualEffectView.frame = CGRect(x: 0, y: 0, width: visualEffectView.frame.width, height: visualEffectView.frame.height) visualEffectView.layer.cornerRadius = radius()