You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace FloatingPanelController.show(_:sender:) with the set(contentViewController:)
And add a sample code to test show(_:sender:) in ContentVC.
`FloatingPanelController.show(_:sender:)` can block 'Show' segue in a
content view controller. 'Show' segue should not be handled by
'FloatingPanelController`. So I replace this method.
Copy file name to clipboardExpand all lines: README.md
+40-6
Original file line number
Diff line number
Diff line change
@@ -25,14 +25,15 @@ The new interface displays the related contents and utilities in parallel as a u
25
25
-[Getting Started](#getting-started)
26
26
-[Usage](#usage)
27
27
-[Customize the layout of a floating panel with `FloatingPanelLayout` protocol](#customize-the-layout-of-a-floating-panel-with--floatingpanellayout-protocol)
28
-
-[Change the initial position, supported positions and height](#change-the-initial-position-supported-positions-and-height)
28
+
-[Change the initial positionand height](#change-the-initial-position-and-height)
29
29
-[Support your landscape layout](#support-your-landscape-layout)
30
30
-[Customize the behavior with `FloatingPanelBehavior` protocol](#customize-the-behavior-with-floatingpanelbehavior-protocol)
31
31
-[Modify your floating panel's interaction](#modify-your-floating-panels-interaction)
32
32
-[Create an additional floating panel for a detail](#create-an-additional-floating-panel-for-a-detail)
33
33
-[Move a position with an animation](#move-a-position-with-an-animation)
34
34
-[Make your contents correspond with a floating panel behavior](#make-your-contents-correspond-with-a-floating-panel-behavior)
35
35
-[Notes](#notes)
36
+
-['Show' or 'Show Detail' Segues from `FloatingPanelController`'s content view controller](#show-or-show-detail-segues-from-floatingpanelcontrollers-content-view-controller)
36
37
-[FloatingPanelSurfaceView's issue on iOS 10](#floatingpanelsurfaceviews-issue-on-ios-10)
37
38
-[Author](#author)
38
39
-[License](#license)
@@ -96,14 +97,14 @@ class ViewController: UIViewController, FloatingPanelControllerDelegate {
96
97
// Assign self as the delegate of the controller.
97
98
fpc.delegate=self// Optional
98
99
99
-
//Add a content view controller.
100
+
//Set a content view controller.
100
101
let contentVC =ContentViewController()
101
-
fpc.show(contentVC, sender: nil)
102
+
fpc.set(viewController: contentVC)
102
103
103
104
// Track a scroll view(or the siblings) in the content view controller.
104
105
fpc.track(scrollView: contentVC.tableView)
105
106
106
-
// Add the views managed by the `FloatingPanelController` object to self.view.
107
+
// Add and show the views managed by the `FloatingPanelController` object to self.view.
107
108
fpc.addPanel(toParent: self)
108
109
}
109
110
@@ -222,7 +223,7 @@ class ViewController: UIViewController, FloatingPanelControllerDelegate {
@@ -279,6 +280,39 @@ class ViewController: UIViewController, FloatingPanelControllerDelegate {
279
280
280
281
## Notes
281
282
283
+
### 'Show' or 'Show Detail' Segues from `FloatingPanelController`'s content view controller
284
+
285
+
'Show' or 'Show Detail' segues from a content view controller will be managed by a view controller(hereinafter called 'master VC') adding a floating panel. Because a floating panel is just a subview of the master VC.
286
+
287
+
`FloatingPanelController` has no way to manage a stack of view controllers like `UINavigationController`. If so, it would be so complicated and the interface will become `UINavigationController`. This component should not have the responsibility to manage the stack.
288
+
289
+
By the way, a content view controller can present a view controller modally with `present(_:animated:completion:)` or 'Present Modally' segue.
290
+
291
+
However, sometimes you want to show a destination view controller of 'Show' or 'Show Detail' segue with another floating panel. It's possible to override `show(_:sender)` of the master VC!
A `FloatingPanelController` object proxies an action for `show(_:sender)` to the master VC. That's why the master VC can handle a destination view controller of a 'Show' or 'Show Detail' segue and you can hook `show(_:sender)` to show a secondally floating panel set the destination view controller to the content.
313
+
314
+
It's a greate way to decouple between a floating panel and the content VC.
315
+
282
316
### FloatingPanelSurfaceView's issue on iOS 10
283
317
284
318
* On iOS 10, `FloatingPanelSurfaceView.cornerRadius` isn't not automatically masked with the top rounded corners because of UIVisualEffectView issue. See https://forums.developer.apple.com/thread/50854.
0 commit comments