Skip to content

Commit

Permalink
Revise the doc comment
Browse files Browse the repository at this point in the history
  • Loading branch information
scenee committed Nov 12, 2021
1 parent ca5b1fd commit 9bcadf5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Sources/Controller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ open class FloatingPanelController: UIViewController {
}

/// The layout object managed by the controller
///
/// To apply the new layout object into views managed by the controller, you need to call ``invalidateLayout()``.
@objc
public var layout: FloatingPanelLayout {
get { _layout }
Expand Down Expand Up @@ -603,15 +605,14 @@ open class FloatingPanelController: UIViewController {

// MARK: - Utilities

/// Updates the layout object from the ``FloatingPanelControllerDelegate`` delegate method and lays out the views managed
/// by the controller immediately.
/// Invalidates the current layout of the views and apply the ``layout`` object into them.
///
/// This method updates the ``layout`` by a layout object returned by the delegate method,
/// `floatingPanel(_: FloatingPanelController, layoutFor: UITraitCollection)`.
/// And then it calls `layoutIfNeeded()` of the root view to force the view to update the layout immediately.
/// This lays out the views managed by the controller immediately according to the ``layout``
/// object, by calling `layoutIfNeeded()` of the root view to force the view to update its layout.
/// It can be called in an animation block.
///
/// - Attention: `invalidateLayout()` can override a layout object assigned to ``layout`` just before calling it, with one returned by the delegate method.
/// If the controller has a delegate object, this can override lts``layout`` object with one returned by
/// the delegate method, `floatingPanel(_: FloatingPanelController, layoutFor: UITraitCollection)`.
@objc
public func invalidateLayout() {
if let newLayout = self.delegate?.floatingPanel?(self, layoutFor: traitCollection) {
Expand Down

0 comments on commit 9bcadf5

Please sign in to comment.