Skip to content

Commit

Permalink
Added delegate method to allow consumers to preform an action when th…
Browse files Browse the repository at this point in the history
…e user starts panning the sheet (#2077)
  • Loading branch information
cbowdoin authored Jul 26, 2024
1 parent 1d6be3a commit 411c8c5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ios/FluentUI/Bottom Sheet/BottomSheetController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ public protocol BottomSheetControllerDelegate: AnyObject {

/// Called when `collapsedHeightInSafeArea` changes.
@objc optional func bottomSheetControllerCollapsedHeightInSafeAreaDidChange(_ bottomSheetController: BottomSheetController)

/// Called when the user initiates the pan gesture
///
/// - Parameters:
/// - bottomSheetController: The caller object.
/// - expansionState: The expansion state that the sheet moved from
@objc optional func bottomSheetStartedPan(_ bottomSheetController: BottomSheetController, from expansionState: BottomSheetExpansionState)
}

/// Interactions that can trigger a state change.
Expand Down Expand Up @@ -765,6 +772,7 @@ public class BottomSheetController: UIViewController, Shadowable, TokenizedContr
switch sender.state {
case .began:
completeAnimationsIfNeeded()
delegate?.bottomSheetStartedPan?(self, from: currentExpansionState)
currentExpansionState = .transitioning
fallthrough
case .changed:
Expand Down

0 comments on commit 411c8c5

Please # to comment.