From 34ebb3bf19b569e60ae1ad0e3aa9c3092306d635 Mon Sep 17 00:00:00 2001 From: Shin Yamamoto Date: Tue, 19 Sep 2023 13:18:41 +0900 Subject: [PATCH 1/6] Use alerts syntax in the README --- README.md | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e30820c1..62e45fa0 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,8 @@ Examples can be found here: FloatingPanel is written in Swift 5.0+ and compatible with iOS 11.0+. -:pencil2: If you'd like to use Swift 4.0, please use FloatingPanel v1. +> [!NOTE] +> If you'd like to use Swift 4.0, please use FloatingPanel v1. ## Installation @@ -105,7 +106,8 @@ it, simply add the following line to your Podfile: pod 'FloatingPanel' ``` -:pencil2: FloatingPanel v1.7.0 or later requires CocoaPods v1.7.0+ for `swift_versions` support. +> [!NOTE] +> FloatingPanel v1.7.0 or later requires CocoaPods v1.7.0+ for `swift_versions` support. ### Carthage @@ -165,7 +167,8 @@ self.present(fpc, animated: true, completion: nil) You can show a floating panel over UINavigationController from the container view controllers as a modality of `.overCurrentContext` style. -:pencil2: FloatingPanelController has the custom presentation controller. If you would like to customize the presentation/dismissal, please see [Transitioning](https://github.com/SCENEE/FloatingPanel/blob/master/Sources/Transitioning.swift). +> [!NOTE] +> FloatingPanelController has the custom presentation controller. If you would like to customize the presentation/dismissal, please see [Transitioning](https://github.com/SCENEE/FloatingPanel/blob/master/Sources/Transitioning.swift). ## View hierarchy @@ -249,7 +252,8 @@ fpc.contentMode = .fitToBounds Otherwise, `FloatingPanelController` fixes the content by the height of the top most position. -:pencil2: In `.fitToBounds` mode, the surface height changes as following a user interaction so that you have a responsibility to configure Auto Layout constrains not to break the layout of a content view by the elastic surface height. +> [!NOTE] +> In `.fitToBounds` mode, the surface height changes as following a user interaction so that you have a responsibility to configure Auto Layout constrains not to break the layout of a content view by the elastic surface height. ### Customize the layout with `FloatingPanelLayout` protocol @@ -347,7 +351,8 @@ class IntrinsicPanelLayout: FloatingPanelLayout { } ``` -:pencil2: `FloatingPanelIntrinsicLayout` is deprecated on v1. +> [!WARNING] +> `FloatingPanelIntrinsicLayout` is deprecated on v1. #### Specify an anchor for each state by an inset of the `FloatingPanelController.view` frame @@ -364,7 +369,8 @@ class MyFullScreenLayout: FloatingPanelLayout { } ``` -:pencil2: `FloatingPanelFullScreenLayout` is deprecated on v1. +> [!WARNING] +> `FloatingPanelFullScreenLayout` is deprecated on v1. #### Change the backdrop alpha @@ -428,7 +434,8 @@ class CustomPanelBehavior: FloatingPanelBehavior { } ``` -:pencil2: `floatingPanel(_ vc:behaviorFor:)` is deprecated on v1. +> [!WARNING] +> `floatingPanel(_ vc:behaviorFor:)` is deprecated on v1. #### Activate the rubber-band effect on panel edges @@ -470,7 +477,8 @@ func floatingPanelDidMove(_ vc: FloatingPanelController) { } ``` -:pencil2: `{top,bottom}InteractionBuffer` property is removed from `FloatingPanelLayout` since v2. +> [!WARNING] +> `{top,bottom}InteractionBuffer` property is removed from `FloatingPanelLayout` since v2. ### Customize the surface design @@ -511,7 +519,8 @@ fpc.surfaceView.grabberHandlePadding = 10.0 fpc.surfaceView.grabberHandleSize = .init(width: 44.0, height: 12.0) ``` -:pencil2: Note that `grabberHandleSize` width and height are reversed in the left/right position. +> [!NOTE] +> `grabberHandleSize` width and height are reversed in the left/right position. #### Customize content padding from surface edges From 6fb9a9b3a2e456c66f6773eac273a30f42951fca Mon Sep 17 00:00:00 2001 From: Shin Yamamoto Date: Tue, 19 Sep 2023 13:25:41 +0900 Subject: [PATCH 2/6] Add a new section for the new API --- README.md | 91 ++++++++++++++++++++++++---------------- Sources/Controller.swift | 5 +-- 2 files changed, 57 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 62e45fa0..09729a8c 100644 --- a/README.md +++ b/README.md @@ -21,46 +21,47 @@ Please see also [the API reference](https://floatingpanel.github.io/2.7.0/docume - [Features](#features) - [Requirements](#requirements) - [Installation](#installation) - - [CocoaPods](#cocoapods) - - [Carthage](#carthage) - - [Swift Package Manager](#swift-package-manager) + - [CocoaPods](#cocoapods) + - [Carthage](#carthage) + - [Swift Package Manager](#swift-package-manager) - [Getting Started](#getting-started) - - [Add a floating panel as a child view controller](#add-a-floating-panel-as-a-child-view-controller) - - [Present a floating panel as a modality](#present-a-floating-panel-as-a-modality) + - [Add a floating panel as a child view controller](#add-a-floating-panel-as-a-child-view-controller) + - [Present a floating panel as a modality](#present-a-floating-panel-as-a-modality) - [View hierarchy](#view-hierarchy) - [Usage](#usage) - - [Show/Hide a floating panel in a view with your view hierarchy](#showhide-a-floating-panel-in-a-view-with-your-view-hierarchy) - - [Scale the content view when the surface position changes](#scale-the-content-view-when-the-surface-position-changes) - - [Customize the layout with `FloatingPanelLayout` protocol](#customize-the-layout-with-floatingpanellayout-protocol) - - [Change the initial layout](#change-the-initial-layout) - - [Update your panel layout](#update-your-panel-layout) - - [Support your landscape layout](#support-your-landscape-layout) - - [Use the intrinsic size of a content in your panel layout](#use-the-intrinsic-size-of-a-content-in-your-panel-layout) - - [Specify an anchor for each state by an inset of the `FloatingPanelController.view` frame](#specify-an-anchor-for-each-state-by-an-inset-of-the-floatingpanelcontrollerview-frame) - - [Change the backdrop alpha](#change-the-backdrop-alpha) - - [Using custome panel states](#using-custome-panel-states) - - [Customize the behavior with `FloatingPanelBehavior` protocol](#customize-the-behavior-with-floatingpanelbehavior-protocol) - - [Modify your floating panel's interaction](#modify-your-floating-panels-interaction) - - [Activate the rubber-band effect on panel edges](#activate-the-rubber-band-effect-on-panel-edges) - - [Manage the projection of a pan gesture momentum](#manage-the-projection-of-a-pan-gesture-momentum) - - [Specify the panel move's boundary](#specify-the-panel-moves-boundary) - - [Customize the surface design](#customize-the-surface-design) - - [Modify your surface appearance](#modify-your-surface-appearance) - - [Use a custom grabber handle](#use-a-custom-grabber-handle) - - [Customize layout of the grabber handle](#customize-layout-of-the-grabber-handle) - - [Customize content padding from surface edges](#customize-content-padding-from-surface-edges) - - [Customize margins of the surface edges](#customize-margins-of-the-surface-edges) - - [Customize gestures](#customize-gestures) - - [Suppress the panel interaction](#suppress-the-panel-interaction) - - [Add tap gestures to the surface view](#add-tap-gestures-to-the-surface-view) - - [Interrupt the delegate methods of `FloatingPanelController.panGestureRecognizer`](#interrupt-the-delegate-methods-of-floatingpanelcontrollerpangesturerecognizer) - - [Create an additional floating panel for a detail](#create-an-additional-floating-panel-for-a-detail) - - [Move a position with an animation](#move-a-position-with-an-animation) - - [Work your contents together with a floating panel behavior](#work-your-contents-together-with-a-floating-panel-behavior) - - [Enabling the tap-to-dismiss action of the backdrop view](#enabling-the-tap-to-dismiss-action-of-the-backdrop-view) + - [Show/Hide a floating panel in a view with your view hierarchy](#showhide-a-floating-panel-in-a-view-with-your-view-hierarchy) + - [Scale the content view when the surface position changes](#scale-the-content-view-when-the-surface-position-changes) + - [Customize the layout with `FloatingPanelLayout` protocol](#customize-the-layout-with-floatingpanellayout-protocol) + - [Change the initial layout](#change-the-initial-layout) + - [Update your panel layout](#update-your-panel-layout) + - [Support your landscape layout](#support-your-landscape-layout) + - [Use the intrinsic size of a content in your panel layout](#use-the-intrinsic-size-of-a-content-in-your-panel-layout) + - [Specify an anchor for each state by an inset of the `FloatingPanelController.view` frame](#specify-an-anchor-for-each-state-by-an-inset-of-the-floatingpanelcontrollerview-frame) + - [Change the backdrop alpha](#change-the-backdrop-alpha) + - [Using custome panel states](#using-custome-panel-states) + - [Customize the behavior with `FloatingPanelBehavior` protocol](#customize-the-behavior-with-floatingpanelbehavior-protocol) + - [Modify your floating panel's interaction](#modify-your-floating-panels-interaction) + - [Activate the rubber-band effect on panel edges](#activate-the-rubber-band-effect-on-panel-edges) + - [Manage the projection of a pan gesture momentum](#manage-the-projection-of-a-pan-gesture-momentum) + - [Specify the panel move's boundary](#specify-the-panel-moves-boundary) + - [Customize the surface design](#customize-the-surface-design) + - [Modify your surface appearance](#modify-your-surface-appearance) + - [Use a custom grabber handle](#use-a-custom-grabber-handle) + - [Customize layout of the grabber handle](#customize-layout-of-the-grabber-handle) + - [Customize content padding from surface edges](#customize-content-padding-from-surface-edges) + - [Customize margins of the surface edges](#customize-margins-of-the-surface-edges) + - [Customize gestures](#customize-gestures) + - [Suppress the panel interaction](#suppress-the-panel-interaction) + - [Add tap gestures to the surface view](#add-tap-gestures-to-the-surface-view) + - [Interrupt the delegate methods of `FloatingPanelController.panGestureRecognizer`](#interrupt-the-delegate-methods-of-floatingpanelcontrollerpangesturerecognizer) + - [Create an additional floating panel for a detail](#create-an-additional-floating-panel-for-a-detail) + - [Move a position with an animation](#move-a-position-with-an-animation) + - [Work your contents together with a floating panel behavior](#work-your-contents-together-with-a-floating-panel-behavior) + - [Enabling the tap-to-dismiss action of the backdrop view](#enabling-the-tap-to-dismiss-action-of-the-backdrop-view) + - [Allow to scroll content of the tracking scroll view in addition to the most expanded state](#allow-to-scroll-content-of-the-tracking-scroll-view-in-addition-to-the-most-expanded-state) - [Notes](#notes) - - ['Show' or 'Show Detail' Segues from `FloatingPanelController`'s content view controller](#show-or-show-detail-segues-from-floatingpanelcontrollers-content-view-controller) - - [UISearchController issue](#uisearchcontroller-issue) + - ['Show' or 'Show Detail' Segues from `FloatingPanelController`'s content view controller](#show-or-show-detail-segues-from-floatingpanelcontrollers-content-view-controller) + - [UISearchController issue](#uisearchcontroller-issue) - [Maintainer](#maintainer) - [License](#license) @@ -669,6 +670,24 @@ The tap-to-dismiss action is disabled by default. So it needs to be enabled as b fpc.backdropView.dismissalTapGestureRecognizer.isEnabled = true ``` +### Allow to scroll content of the tracking scroll view in addition to the most expanded state + +Just define conditions to allow content scrolling in `floatingPanel(:_:shouldAllowToScroll:in)` delegate method. If the returned value is true, the scroll content scrolls when its scroll position is not at the top of the content. + +```swift +class MyViewController: FloatingPanelControllerDelegate { + ... + + func floatingPanel( + _ fpc: FloatingPanelController, + shouldAllowToScroll trackingScrollView: UIScrollView, + in state: FloatingPanelState + ) -> Bool { + return state == .full || state == .half + } +} +``` + ## Notes ### 'Show' or 'Show Detail' Segues from `FloatingPanelController`'s content view controller diff --git a/Sources/Controller.swift b/Sources/Controller.swift index b7bb5f41..db12c155 100644 --- a/Sources/Controller.swift +++ b/Sources/Controller.swift @@ -110,15 +110,14 @@ import os.log /// ```swift /// func floatingPanel( /// _ fpc: FloatingPanelController, - /// shouldAllowToScroll trackingScrollView: UIScrollView, + /// shouldAllowToScroll scrollView: UIScrollView, /// in state: FloatingPanelState /// ) -> Bool { /// return state == .full || state == .half /// } /// ``` @objc(floatingPanel:shouldAllowToScroll:in:) - optional - func floatingPanel( + optional func floatingPanel( _ fpc: FloatingPanelController, shouldAllowToScroll scrollView: UIScrollView, in state: FloatingPanelState From b8f7ff825dbfb62ecb1879d5f3cad6afdb0cd785 Mon Sep 17 00:00:00 2001 From: Shin Yamamoto Date: Sat, 30 Sep 2023 15:17:45 +0900 Subject: [PATCH 3/6] Revise the doc comment of shouldProjectMomentum delegate method --- Sources/Behavior.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Sources/Behavior.swift b/Sources/Behavior.swift index 3e5f4804..339f6395 100644 --- a/Sources/Behavior.swift +++ b/Sources/Behavior.swift @@ -25,12 +25,16 @@ public protocol FloatingPanelBehavior { @objc optional var momentumProjectionRate: CGFloat { get } - /// Asks the behavior if a panel should project a momentum of a user interaction to move the proposed position. + /// Asks the behavior if a panel should project a momentum of a user interaction to move the + /// proposed state. /// - /// The default implementation of this method returns true. This method is called for a layout to support all positions(tip, half and full). - /// Therefore, `proposedState` can only be `FloatingPanelState.tip` or `FloatingPanelState.full`. + /// The default implementation of this method returns `false`. This method is called for called + /// for all states defined by the current layout object. @objc optional - func shouldProjectMomentum(_ fpc: FloatingPanelController, to proposedState: FloatingPanelState) -> Bool + func shouldProjectMomentum( + _ fpc: FloatingPanelController, + to proposedState: FloatingPanelState + ) -> Bool /// Returns the progress to redirect to the previous position. /// From 4996ce1a843bc98d0f1fa26b8f8f98ead7861a65 Mon Sep 17 00:00:00 2001 From: Shin Yamamoto Date: Sat, 30 Sep 2023 15:20:06 +0900 Subject: [PATCH 4/6] Remove unnecessary notes --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 09729a8c..a4bd9f12 100644 --- a/README.md +++ b/README.md @@ -93,9 +93,6 @@ Examples can be found here: FloatingPanel is written in Swift 5.0+ and compatible with iOS 11.0+. -> [!NOTE] -> If you'd like to use Swift 4.0, please use FloatingPanel v1. - ## Installation ### CocoaPods @@ -107,9 +104,6 @@ it, simply add the following line to your Podfile: pod 'FloatingPanel' ``` -> [!NOTE] -> FloatingPanel v1.7.0 or later requires CocoaPods v1.7.0+ for `swift_versions` support. - ### Carthage For [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`: From 046ed3df5b43a20909ab28dcbc169df8677df683 Mon Sep 17 00:00:00 2001 From: Shin Yamamoto Date: Sun, 8 Oct 2023 14:29:50 +0900 Subject: [PATCH 5/6] Modify the doc comment of 'floatingPanel(_:shouldAllowToScroll:in:)' --- Sources/Controller.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/Controller.swift b/Sources/Controller.swift index db12c155..2245a576 100644 --- a/Sources/Controller.swift +++ b/Sources/Controller.swift @@ -116,6 +116,9 @@ import os.log /// return state == .full || state == .half /// } /// ``` + /// + /// - Attention: It is recommended that this method always returns the most expanded state(i.e. + /// .full). If it excludes the state, the panel might do unexpected behaviors. @objc(floatingPanel:shouldAllowToScroll:in:) optional func floatingPanel( _ fpc: FloatingPanelController, From dd238884bf85e96a4c6c2703fc2fc1ff0f5c7494 Mon Sep 17 00:00:00 2001 From: Shin Yamamoto Date: Tue, 19 Sep 2023 15:18:14 +0900 Subject: [PATCH 6/6] Version 2.8.0 --- FloatingPanel.podspec | 2 +- README.md | 2 +- Sources/Info.plist | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FloatingPanel.podspec b/FloatingPanel.podspec index cd729be0..ca20515b 100644 --- a/FloatingPanel.podspec +++ b/FloatingPanel.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "FloatingPanel" - s.version = "2.7.0" + s.version = "2.8.0" s.summary = "FloatingPanel is a clean and easy-to-use UI component of a floating panel interface." s.description = <<-DESC FloatingPanel is a clean and easy-to-use UI component for a new interface introduced in Apple Maps, Shortcuts and Stocks app. diff --git a/README.md b/README.md index a4bd9f12..820f03b2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ FloatingPanel is a simple and easy-to-use UI component designed for a user interface featured in Apple Maps, Shortcuts and Stocks app. The user interface displays related content and utilities alongside the main content. -Please see also [the API reference](https://floatingpanel.github.io/2.7.0/documentation/floatingpanel/) for more details. +Please see also [the API reference](https://floatingpanel.github.io/2.8.0/documentation/floatingpanel/) for more details. ![Maps](https://github.com/SCENEE/FloatingPanel/blob/master/assets/maps.gif) ![Stocks](https://github.com/SCENEE/FloatingPanel/blob/master/assets/stocks.gif) diff --git a/Sources/Info.plist b/Sources/Info.plist index ede8db41..20fb31ec 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.7.0 + 2.8.0 CFBundleVersion $(CURRENT_PROJECT_VERSION)