From 697538b7ac2fa2c3f2263e0e363584c2d5d04ddb Mon Sep 17 00:00:00 2001 From: Gert-Jan Vercauteren Date: Thu, 9 Jun 2022 15:38:09 +0800 Subject: [PATCH 01/12] KOA-4949 upgrade to Floatingpanel 2.5.2 --- Backpack.podspec | 2 +- .../Classes/BPKFloatingPanelPosition.swift | 6 ++- .../BackpackFloatingPanelController.swift | 5 +-- .../BottomSheet/Classes/BottomSheet.swift | 34 ++++++++-------- .../Classes/BottomSheetInsets.swift | 28 +++++++++++++ .../Classes/IntrinsicBottomSheetLayout.swift | 31 +++++++++++++++ .../Classes/ModalBottomSheetLayout.swift | 38 ++++++++---------- .../Classes/PersistentBottomSheetLayout.swift | 39 ++++++++----------- Example/Podfile.lock | 8 ++-- 9 files changed, 119 insertions(+), 72 deletions(-) create mode 100644 Backpack/BottomSheet/Classes/IntrinsicBottomSheetLayout.swift diff --git a/Backpack.podspec b/Backpack.podspec index ce215fac3..9b573c7e7 100644 --- a/Backpack.podspec +++ b/Backpack.podspec @@ -37,7 +37,7 @@ Pod::Spec.new do |s| s.dependency 'FSCalendar', '~> 2.8.2' s.dependency 'TTTAttributedLabel', '~> 2.0.0' - s.dependency 'FloatingPanel', '1.6.6' + s.dependency 'FloatingPanel', '2.5.2' s.dependency 'Backpack-Common' s.dependency 'MBProgressHUD', '~> 1.2.0' s.frameworks = 'UIKit', 'Foundation', 'CoreText' diff --git a/Backpack/BottomSheet/Classes/BPKFloatingPanelPosition.swift b/Backpack/BottomSheet/Classes/BPKFloatingPanelPosition.swift index 229899537..d09a891b8 100644 --- a/Backpack/BottomSheet/Classes/BPKFloatingPanelPosition.swift +++ b/Backpack/BottomSheet/Classes/BPKFloatingPanelPosition.swift @@ -29,7 +29,7 @@ public enum BPKFloatingPanelPosition: Int { extension BPKFloatingPanelPosition { // create a BPKFloatingPanelPositon from a 3rd party FloatingPanelPosition - init(floatinPanelPosition: FloatingPanelPosition) { + init(floatinPanelPosition: FloatingPanelState) { switch floatinPanelPosition { case .full: self = .full @@ -39,10 +39,12 @@ extension BPKFloatingPanelPosition { self = .tip case .hidden: self = .hidden + default: + self = .half } } - var asFloatingPanelPosition: FloatingPanelPosition { + var asFloatingPanelPosition: FloatingPanelState { switch self { case .full: return .full diff --git a/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift b/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift index 3aa235925..23d310b1d 100644 --- a/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift +++ b/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift @@ -87,7 +87,7 @@ private extension BPKFloatingPanelController { outsideSafeAreaView.topAnchor.constraint( greaterThanOrEqualTo: content.view.topAnchor, - constant: layout.insetFor(position: .half) ?? 0 + constant: 0 ) ]) } @@ -130,12 +130,11 @@ private extension BPKFloatingPanelController { } func updateScrollViewInsetsForBottomSection() { - guard let scrollView = scrollView, let bottomSection = bottomSectionViewController else { return } + guard let scrollView = trackingScrollView, let bottomSection = bottomSectionViewController else { return } let insets = UIEdgeInsets(top: 0, left: 0, bottom: bottomSection.view.frame.size.height, right: 0) scrollView.contentInset = insets scrollView.scrollIndicatorInsets = insets } - } private extension BPKFloatingPanelController { diff --git a/Backpack/BottomSheet/Classes/BottomSheet.swift b/Backpack/BottomSheet/Classes/BottomSheet.swift index b25a12350..c13092c28 100644 --- a/Backpack/BottomSheet/Classes/BottomSheet.swift +++ b/Backpack/BottomSheet/Classes/BottomSheet.swift @@ -75,13 +75,15 @@ public final class BPKBottomSheet: NSObject { private lazy var floatingPanelController: BPKFloatingPanelController = { var panel = BPKFloatingPanelController(delegate: self) + + let appearance = SurfaceAppearance() + appearance.cornerRadius = BPKCornerRadiusLg + panel.surfaceView.appearance = appearance panel.surfaceView.backgroundColor = BPKColor.backgroundTertiaryColor - panel.surfaceView.cornerRadius = BPKCornerRadiusLg - panel.surfaceView.grabberTopPadding = BPKSpacingMd - panel.surfaceView.grabberHandleHeight = BPKSpacingSm - panel.surfaceView.grabberHandleWidth = Constants.grabberHandleWidth + panel.surfaceView.grabberHandlePadding = BPKSpacingMd panel.surfaceView.grabberHandle.barColor = BPKColor.skyGrayTint06 + panel.surfaceView.grabberHandleSize = .init(width: Constants.grabberHandleWidth, height: BPKSpacingSm) switch presentationStyle { case .modal: @@ -179,7 +181,9 @@ public final class BPKBottomSheet: NSObject { assertionFailure("present(_:animated:completion:) not compatible with persistent presentation style") return } - if let scrollView = floatingPanelController.scrollView { + + // ToODO --> WHAT IS THIS? + if let scrollView = floatingPanelController.trackingScrollView { scrollView.setContentOffset(.init(x: 0, y: -scrollView.adjustedContentInset.top), animated: animated) } @@ -200,7 +204,7 @@ public final class BPKBottomSheet: NSObject { assertionFailure("present(in:animated:completion:) not compatible with modal presentation style") return } - floatingPanelController.addPanel(toParent: parent, belowView: nil, animated: true) + floatingPanelController.addPanel(toParent: parent) } /// This method removes the panel from the parent view @@ -213,7 +217,7 @@ public final class BPKBottomSheet: NSObject { /// It can be useful, for example, when changing the inner constraints of the `contentViewController` /// and bottom sheet needs to be resized to fit the content. public func updateLayout() { - floatingPanelController.updateLayout() +// floatingPanelController.updateLayout() } /// This method allows change the presentation mode of the BPKBottomSheet. @@ -225,26 +229,20 @@ public final class BPKBottomSheet: NSObject { } extension BPKBottomSheet: FloatingPanelControllerDelegate { - final class IntrinsicLayout: FloatingPanelIntrinsicLayout { - func backdropAlphaFor(position: FloatingPanelPosition) -> CGFloat { - return Constants.backdropAlpha - } - } - public func floatingPanel( _ viewController: FloatingPanelController, layoutFor newCollection: UITraitCollection - ) -> FloatingPanelLayout? { + ) -> FloatingPanelLayout { switch self.presentationStyle { case .modal: - return scrollView == nil ? IntrinsicLayout() : ModalBottomSheetLayout(insets: insets) + return scrollView == nil ? IntrinsicBottomSheetLayout() : ModalBottomSheetLayout(insets: insets) case .persistent: return PersistentBottomSheetLayout(insets: insets) } } public func floatingPanelDidChangePosition(_ viewController: FloatingPanelController) { - delegate?.bottomSheetDidChangePosition(.init(floatinPanelPosition: viewController.position)) +// delegate?.bottomSheetDidChangePosition(.init(floatinPanelPosition: viewController.position)) } } @@ -253,7 +251,7 @@ private enum Constants { static let grabberHandleWidth: CGFloat = 60.0 } -extension FloatingPanelPosition { +extension FloatingPanelState { var asBPKFloatingPanelPosition: BPKFloatingPanelPosition { switch self { case .full: @@ -264,6 +262,8 @@ extension FloatingPanelPosition { return .tip case .hidden: return .hidden + default: + return .half } } } diff --git a/Backpack/BottomSheet/Classes/BottomSheetInsets.swift b/Backpack/BottomSheet/Classes/BottomSheetInsets.swift index a54743671..140231f5a 100644 --- a/Backpack/BottomSheet/Classes/BottomSheetInsets.swift +++ b/Backpack/BottomSheet/Classes/BottomSheetInsets.swift @@ -16,6 +16,8 @@ * limitations under the License. */ +import FloatingPanel + public struct BottomSheetInsets { public let full: CGFloat? public let half: CGFloat? @@ -37,3 +39,29 @@ public struct BottomSheetInsets { self.tip = tip } } + +extension BottomSheetInsets { + var fullAnchor: FloatingPanelLayoutAnchoring { + guard let full = full else { + return FloatingPanelLayoutAnchor(absoluteInset: 0, edge: .top, referenceGuide: .safeArea) + } + + return FloatingPanelLayoutAnchor(absoluteInset: full, edge: .top, referenceGuide: .safeArea) + } + + var halfAnchor: FloatingPanelLayoutAnchoring { + guard let half = half else { + return FloatingPanelLayoutAnchor(fractionalInset: 0.5, edge: .bottom, referenceGuide: .safeArea) + } + + return FloatingPanelLayoutAnchor(absoluteInset: half, edge: .bottom, referenceGuide: .safeArea) + } + + var tipAnchor: FloatingPanelLayoutAnchoring { + guard let tip = tip else { + return FloatingPanelLayoutAnchor(absoluteInset: 120.0, edge: .bottom, referenceGuide: .safeArea) + } + + return FloatingPanelLayoutAnchor(absoluteInset: tip, edge: .bottom, referenceGuide: .safeArea) + } +} diff --git a/Backpack/BottomSheet/Classes/IntrinsicBottomSheetLayout.swift b/Backpack/BottomSheet/Classes/IntrinsicBottomSheetLayout.swift new file mode 100644 index 000000000..42fe589ca --- /dev/null +++ b/Backpack/BottomSheet/Classes/IntrinsicBottomSheetLayout.swift @@ -0,0 +1,31 @@ +/* + * Backpack - Skyscanner's Design System + * + * Copyright 2018 Skyscanner Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import FloatingPanel + +class IntrinsicBottomSheetLayout: FloatingPanelLayout { + let position: FloatingPanelPosition = .bottom + let initialState: FloatingPanelState = .full + + var anchors: [FloatingPanelState: FloatingPanelLayoutAnchoring] { + return [ + .full: FloatingPanelIntrinsicLayoutAnchor(absoluteOffset: 0, referenceGuide: .safeArea), + .half: FloatingPanelIntrinsicLayoutAnchor(fractionalOffset: 0.5, referenceGuide: .safeArea) + ] + } +} diff --git a/Backpack/BottomSheet/Classes/ModalBottomSheetLayout.swift b/Backpack/BottomSheet/Classes/ModalBottomSheetLayout.swift index 2b4d76981..e217acb22 100644 --- a/Backpack/BottomSheet/Classes/ModalBottomSheetLayout.swift +++ b/Backpack/BottomSheet/Classes/ModalBottomSheetLayout.swift @@ -22,40 +22,34 @@ import FloatingPanel /// will not be interactable, there will be an overlay in the Parent ViewController, /// and the BPKBottomShet can be dismissed public final class ModalBottomSheetLayout: FloatingPanelLayout { + public let position: FloatingPanelPosition = .bottom + /// Initial position of BPKBottomSheet - public var initialPosition: FloatingPanelPosition { - return .half - } + public let initialState: FloatingPanelState = .half /// All supported positions of BPKBottomSheet - public var supportedPositions: Set { - return [.full, .half] + public var anchors: [FloatingPanelState: FloatingPanelLayoutAnchoring] { + return [ + .full: insets.fullAnchor, + .half: insets.halfAnchor + ] } - /// Insets that will be used for the modal presentation - private let insets: BottomSheetInsets - - public init(insets: BottomSheetInsets) { - self.insets = insets - } - - /// Method to describe the height of BPKBottomSheet in each position - public func insetFor(position: FloatingPanelPosition) -> CGFloat? { - switch position { - case .half: return insets.half - default: return nil - } - } - /// Method to define the overlay in the parent view controller - public func backdropAlphaFor(position: FloatingPanelPosition) -> CGFloat { - switch position { + public func backdropAlpha(for state: FloatingPanelState) -> CGFloat { + switch state { case .full, .half: return Constants.backdropAlpha default: return 0.0 } } + + private let insets: BottomSheetInsets + + public init(insets: BottomSheetInsets) { + self.insets = insets + } } private enum Constants { diff --git a/Backpack/BottomSheet/Classes/PersistentBottomSheetLayout.swift b/Backpack/BottomSheet/Classes/PersistentBottomSheetLayout.swift index 35f15d330..c3f3094fe 100644 --- a/Backpack/BottomSheet/Classes/PersistentBottomSheetLayout.swift +++ b/Backpack/BottomSheet/Classes/PersistentBottomSheetLayout.swift @@ -21,14 +21,24 @@ import FloatingPanel /// Layout implementation where the BPKBottomSheet will remain persistent in the parent /// ViewController. There is no overlay and the parent ViewController remains interactable public final class PersistentBottomSheetLayout: FloatingPanelLayout { + /// The position of the floating panel + public let position: FloatingPanelPosition = .bottom + /// Initial position of BPKBottomSheet - public var initialPosition: FloatingPanelPosition { - return .half - } - + public let initialState: FloatingPanelState = .half + /// All supported positions of BPKBottomSheet - public var supportedPositions: Set { - return [.half, .full, .tip] + public var anchors: [FloatingPanelState: FloatingPanelLayoutAnchoring] { + return [ + .full: insets.fullAnchor, + .half: insets.halfAnchor, + .tip: insets.tipAnchor + ] + } + + /// Method to define the overlay in the parent view controller + public func backdropAlpha(for state: FloatingPanelState) -> CGFloat { + return 0 } private let insets: BottomSheetInsets @@ -36,23 +46,6 @@ public final class PersistentBottomSheetLayout: FloatingPanelLayout { public init(insets: BottomSheetInsets) { self.insets = insets } - - /// Method to describe the height of BPKBottomSheet in each position - public func insetFor(position: FloatingPanelPosition) -> CGFloat? { - switch position { - case .half: - return insets.half - case .tip: - return insets.tip - default: - return insets.full - } - } - - /// Method to define the overlay in the parent view controller - public func backdropAlphaFor(position: FloatingPanelPosition) -> CGFloat { - return 0.0 - } } private enum Constants { diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 022af7798..bab1ba70c 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -11,7 +11,7 @@ PODS: - AppCenter/Core - Backpack (50.1.0): - Backpack-Common - - FloatingPanel (= 1.6.6) + - FloatingPanel (= 2.5.2) - FSCalendar (~> 2.8.2) - MBProgressHUD (~> 1.2.0) - TTTAttributedLabel (~> 2.0.0) @@ -22,7 +22,7 @@ PODS: - Backpack-SwiftUI/Tests (50.1.0): - Backpack-Common - SnapshotTesting (~> 1.9.0) - - FloatingPanel (1.6.6) + - FloatingPanel (2.5.2) - FSCalendar (2.8.4) - iOSSnapshotTestCase (6.2.0): - iOSSnapshotTestCase/SwiftSupport (= 6.2.0) @@ -71,11 +71,11 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AppCenter: 87ef6eefd8ade4df59e88951288587429f3dd2a5 - Backpack: b36757156da0ccf4a9dd88fb071406e938cb3f32 + Backpack: f65b0ad177383531f481acbb295633d853719318 Backpack-Common: 6d109ceb76206f11e6513ca6f64b98b4db46e864 Backpack-Fonts: 89f9d18aeeb0f6fb026e301261d3af3ee6a8ec6d Backpack-SwiftUI: 89295a2b35703b4d4d074b5a9f75ccce7bad83ff - FloatingPanel: 5fe605e073e60395bc4bb416fd513d0fa38a6558 + FloatingPanel: 935712d7a8076630135fbbd47f717700913efef9 FSCalendar: 2d1d0d9398f12d439f55c1fe0f01525b151b8260 iOSSnapshotTestCase: 9ab44cb5aa62b84d31847f40680112e15ec579a6 MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406 From 991ba2b1b93b29d83b53773449173bbc3bc097a2 Mon Sep 17 00:00:00 2001 From: Gert-Jan Vercauteren Date: Thu, 9 Jun 2022 15:47:49 +0800 Subject: [PATCH 02/12] KOA-4949 tidy up some previously commented code --- Backpack/BottomSheet/Classes/BottomSheet.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Backpack/BottomSheet/Classes/BottomSheet.swift b/Backpack/BottomSheet/Classes/BottomSheet.swift index c13092c28..d0fe799f1 100644 --- a/Backpack/BottomSheet/Classes/BottomSheet.swift +++ b/Backpack/BottomSheet/Classes/BottomSheet.swift @@ -217,7 +217,7 @@ public final class BPKBottomSheet: NSObject { /// It can be useful, for example, when changing the inner constraints of the `contentViewController` /// and bottom sheet needs to be resized to fit the content. public func updateLayout() { -// floatingPanelController.updateLayout() + floatingPanelController.invalidateLayout() } /// This method allows change the presentation mode of the BPKBottomSheet. @@ -242,7 +242,7 @@ extension BPKBottomSheet: FloatingPanelControllerDelegate { } public func floatingPanelDidChangePosition(_ viewController: FloatingPanelController) { -// delegate?.bottomSheetDidChangePosition(.init(floatinPanelPosition: viewController.position)) + delegate?.bottomSheetDidChangePosition(.init(floatinPanelPosition: viewController.state)) } } From 02fa21a318c54f66dfe7e2aab0059ea7f522480f Mon Sep 17 00:00:00 2001 From: Gert-Jan Vercauteren Date: Thu, 9 Jun 2022 15:55:33 +0800 Subject: [PATCH 03/12] KOA-4949 fix height constraint --- .../Classes/BackpackFloatingPanelController.swift | 2 +- Backpack/BottomSheet/Classes/BottomSheetInsets.swift | 11 ++++++++++- .../Classes/PersistentBottomSheetLayout.swift | 5 ----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift b/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift index 23d310b1d..3a06be2bd 100644 --- a/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift +++ b/Backpack/BottomSheet/Classes/BackpackFloatingPanelController.swift @@ -87,7 +87,7 @@ private extension BPKFloatingPanelController { outsideSafeAreaView.topAnchor.constraint( greaterThanOrEqualTo: content.view.topAnchor, - constant: 0 + constant: BottomSheetInsets.Constants.bottomSheetHeightInHalfPosition ) ]) } diff --git a/Backpack/BottomSheet/Classes/BottomSheetInsets.swift b/Backpack/BottomSheet/Classes/BottomSheetInsets.swift index 140231f5a..2504603d8 100644 --- a/Backpack/BottomSheet/Classes/BottomSheetInsets.swift +++ b/Backpack/BottomSheet/Classes/BottomSheetInsets.swift @@ -23,9 +23,18 @@ public struct BottomSheetInsets { public let half: CGFloat? public let tip: CGFloat? + public enum Constants { + static let bottomSheetHeightInHalfPosition: CGFloat = 386.0 + static let bottomSheetHeightInTipPosition: CGFloat = 120.0 + } + /// Default insets for the bottom sheet. public init() { - self.init(full: nil, half: 386.0, tip: 120.0) + self.init( + full: nil, + half: Constants.bottomSheetHeightInHalfPosition, + tip: Constants.bottomSheetHeightInTipPosition + ) } /// Use this initializer to have full control over the heights and spacing of your bottom sheet diff --git a/Backpack/BottomSheet/Classes/PersistentBottomSheetLayout.swift b/Backpack/BottomSheet/Classes/PersistentBottomSheetLayout.swift index c3f3094fe..4bee35fa7 100644 --- a/Backpack/BottomSheet/Classes/PersistentBottomSheetLayout.swift +++ b/Backpack/BottomSheet/Classes/PersistentBottomSheetLayout.swift @@ -47,8 +47,3 @@ public final class PersistentBottomSheetLayout: FloatingPanelLayout { self.insets = insets } } - -private enum Constants { - static let bottomSheetHeightInHalfPosition: CGFloat = 386.0 - static let bottomSheetHeightInTipPosition: CGFloat = 120.0 -} From 5f6bbbda9cd6489f3bd8ed73fd59757975e3f70e Mon Sep 17 00:00:00 2001 From: Gert-Jan Vercauteren Date: Thu, 9 Jun 2022 16:30:20 +0800 Subject: [PATCH 04/12] KOA-4949 remove comment --- Backpack/BottomSheet/Classes/BottomSheet.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Backpack/BottomSheet/Classes/BottomSheet.swift b/Backpack/BottomSheet/Classes/BottomSheet.swift index d0fe799f1..e417a6cdd 100644 --- a/Backpack/BottomSheet/Classes/BottomSheet.swift +++ b/Backpack/BottomSheet/Classes/BottomSheet.swift @@ -182,7 +182,6 @@ public final class BPKBottomSheet: NSObject { return } - // ToODO --> WHAT IS THIS? if let scrollView = floatingPanelController.trackingScrollView { scrollView.setContentOffset(.init(x: 0, y: -scrollView.adjustedContentInset.top), animated: animated) } From f9854f353c462025ffab5d91006909d5ec4e0eee Mon Sep 17 00:00:00 2001 From: Gert-Jan Vercauteren Date: Thu, 9 Jun 2022 16:38:14 +0800 Subject: [PATCH 05/12] KOA-4949 Update unreleased --- UNRELEASED.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UNRELEASED.md b/UNRELEASED.md index 9a5e87383..8bbef7b97 100644 --- a/UNRELEASED.md +++ b/UNRELEASED.md @@ -1,6 +1,11 @@ # Unreleased > Place your changes below this line. +**Breaking:** + +- BottomSheet + - Updated external library to new version + ## How to write a good changelog entry 1. Add 'Breaking', 'Added' or 'Fixed' in bold depending on if the change will be major, minor or patch according to [semver](semver.org). From 1efa3c9050cdb3b37d0019256207bbc351608436 Mon Sep 17 00:00:00 2001 From: Gert-Jan Vercauteren Date: Fri, 10 Jun 2022 10:32:40 +0800 Subject: [PATCH 06/12] remove unneeded extension --- .../Classes/BPKFloatingPanelPosition.swift | 6 +++--- .../BottomSheet/Classes/BottomSheet.swift | 19 +------------------ 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/Backpack/BottomSheet/Classes/BPKFloatingPanelPosition.swift b/Backpack/BottomSheet/Classes/BPKFloatingPanelPosition.swift index d09a891b8..70612f028 100644 --- a/Backpack/BottomSheet/Classes/BPKFloatingPanelPosition.swift +++ b/Backpack/BottomSheet/Classes/BPKFloatingPanelPosition.swift @@ -28,9 +28,9 @@ public enum BPKFloatingPanelPosition: Int { } extension BPKFloatingPanelPosition { - // create a BPKFloatingPanelPositon from a 3rd party FloatingPanelPosition - init(floatinPanelPosition: FloatingPanelState) { - switch floatinPanelPosition { + // create a BPKFloatingPanelPosition from a 3rd party FloatingPanelPosition + init(floatingPanelPosition: FloatingPanelState) { + switch floatingPanelPosition { case .full: self = .full case .half: diff --git a/Backpack/BottomSheet/Classes/BottomSheet.swift b/Backpack/BottomSheet/Classes/BottomSheet.swift index e417a6cdd..6d6105ad9 100644 --- a/Backpack/BottomSheet/Classes/BottomSheet.swift +++ b/Backpack/BottomSheet/Classes/BottomSheet.swift @@ -241,7 +241,7 @@ extension BPKBottomSheet: FloatingPanelControllerDelegate { } public func floatingPanelDidChangePosition(_ viewController: FloatingPanelController) { - delegate?.bottomSheetDidChangePosition(.init(floatinPanelPosition: viewController.state)) + delegate?.bottomSheetDidChangePosition(.init(floatingPanelPosition: viewController.state)) } } @@ -249,20 +249,3 @@ private enum Constants { static let backdropAlpha: CGFloat = 0.3 static let grabberHandleWidth: CGFloat = 60.0 } - -extension FloatingPanelState { - var asBPKFloatingPanelPosition: BPKFloatingPanelPosition { - switch self { - case .full: - return .full - case .half: - return .half - case .tip: - return .tip - case .hidden: - return .hidden - default: - return .half - } - } -} From 3af05300c18d4ecff2631dc035d4c8e8c7f4eaac Mon Sep 17 00:00:00 2001 From: Gert-Jan Vercauteren Date: Fri, 10 Jun 2022 11:07:30 +0800 Subject: [PATCH 07/12] KOA-4949 move half position --- Backpack/BottomSheet/Classes/IntrinsicBottomSheetLayout.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Backpack/BottomSheet/Classes/IntrinsicBottomSheetLayout.swift b/Backpack/BottomSheet/Classes/IntrinsicBottomSheetLayout.swift index 42fe589ca..34722e3ef 100644 --- a/Backpack/BottomSheet/Classes/IntrinsicBottomSheetLayout.swift +++ b/Backpack/BottomSheet/Classes/IntrinsicBottomSheetLayout.swift @@ -24,8 +24,7 @@ class IntrinsicBottomSheetLayout: FloatingPanelLayout { var anchors: [FloatingPanelState: FloatingPanelLayoutAnchoring] { return [ - .full: FloatingPanelIntrinsicLayoutAnchor(absoluteOffset: 0, referenceGuide: .safeArea), - .half: FloatingPanelIntrinsicLayoutAnchor(fractionalOffset: 0.5, referenceGuide: .safeArea) + .full: FloatingPanelIntrinsicLayoutAnchor(absoluteOffset: 0, referenceGuide: .safeArea) ] } } From d6dec2813afffbf09d46cf7cf07b5fc61b5a4460 Mon Sep 17 00:00:00 2001 From: Gert-Jan Vercauteren Date: Fri, 10 Jun 2022 11:55:23 +0800 Subject: [PATCH 08/12] KOA-4949 change backdrop for intrinsic content size --- .../Bottom Sheet/BottomSheet.storyboard | 220 +++++++++--------- 1 file changed, 109 insertions(+), 111 deletions(-) diff --git a/Example/Backpack/UIKit/Components/Bottom Sheet/BottomSheet.storyboard b/Example/Backpack/UIKit/Components/Bottom Sheet/BottomSheet.storyboard index 8a9549e9c..6db0fd993 100644 --- a/Example/Backpack/UIKit/Components/Bottom Sheet/BottomSheet.storyboard +++ b/Example/Backpack/UIKit/Components/Bottom Sheet/BottomSheet.storyboard @@ -1,9 +1,9 @@ - + - + @@ -21,14 +21,14 @@ - + - + - + - + - + - + - + - + - + - + - + - +