Closed lingxiao closed 4 years ago
implement UBottomSheetCoordinatorDataSource
method in your view controller to modify. sheetPositions and initialPosition methods are what you are looking for.
public protocol UBottomSheetCoordinatorDataSource: class {
///Gesture end animation
var animator: Animatable? {get}
///Sheet positions. For example top, middle, bottom y values.
func sheetPositions(_ availableHeight: CGFloat) -> [CGFloat]
///Initial sheet y position.
func initialPosition(_ availableHeight: CGFloat) -> CGFloat
/**
Top rubber band logic over top limit, min sheet height.
- parameter total: total distance from the top limit
- parameter limit: top limit or min sheet height
*/
func rubberBandLogicTop(_ total: CGFloat, _ limit: CGFloat) -> CGFloat
/**
Bottom rubber band logic below bottom limit, max sheet height.
- parameter total: total distance from the bottom limit
- parameter limit: bottom limit or max sheet height
*/
func rubberBandLogicBottom(_ total: CGFloat, _ limit: CGFloat) -> CGFloat
}
In the default behavior, the modal view pops up to fill 3/4 of the screen. In my particular use case, it'd be nice of the view only fill the bottom 1/4 of the screen. Changing the initial height and y in
didContainerCreate
has no effect:` sheetCoordinator.addSheet(modal, to: self, didContainerCreate: { container in