Provide segment control like iOS13 photo app
[FloatingSwitch]https://github.com/usagimaru/FloatingSwitch
| light | dark |
|---|---|
![]() |
![]() |
github "catelina777/FloatingSegmentedControl"
- Install a custom view on Interface Builder.
- Important: Assign the custom view class as
FloatingSegmentedControllike this. - Set an appropriate layouts. In the default implementation of FloatingSegment, the width follows the intrinsic size.
- Set segments with
setSegments (with:)method. - Set
targetandactionwith addTarget method. Then you can catch control events when users switch segments.
See ViewController.swift for usage.

