Skip to content

Commit e8fa99a

Browse files
committed
Add a description for the backdropAlpha(for:) API
1 parent 7114f54 commit e8fa99a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ The new interface displays the related contents and utilities in parallel as a u
3535
- [Support your landscape layout](#support-your-landscape-layout)
3636
- [Use the intrinsic size of a content in your panel layout](#use-the-intrinsic-size-of-a-content-in-your-panel-layout)
3737
- [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)
38+
- [Change the backdrop alpha](#change-the-backdrop-alpha)
3839
- [Customize the behavior with `FloatingPanelBehavior` protocol](#customize-the-behavior-with-floatingpanelbehavior-protocol)
3940
- [Modify your floating panel's interaction](#modify-your-floating-panels-interaction)
4041
- [Activate the rubber-band effect on panel edges](#activate-the-rubber-band-effect-on-panel-edges)
@@ -370,6 +371,23 @@ class MyFullScreenLayout: FloatingPanelLayout {
370371

371372
:pencil2: `FloatingPanelFullScreenLayout` is deprecated on v1.
372373

374+
#### Change the backdrop alpha
375+
376+
You can change the backdrop alpha by `FloatingPanelLayout.backdropAlpha(for:)` for each state(`.full`, `.half` and `.tip`).
377+
378+
For instance, if a panel seems like the backdrop view isn't there on `.half` state, it's time to implement the backdropAlpha API and return a value for the state as below.
379+
380+
```swift
381+
class MyPanelLayout: FloatingPanelLayout {
382+
func backdropAlpha(for state: FloatingPanelState) -> CGFloat {
383+
switch state {
384+
case .full, .half: return 0.3
385+
default: return 0.0
386+
}
387+
}
388+
}
389+
```
390+
373391
### Customize the behavior with `FloatingPanelBehavior` protocol
374392

375393
#### Modify your floating panel's interaction

0 commit comments

Comments
 (0)