FloatingSwitch
FloatingSwitch copied to clipboard
A replication of a segmented control in the iOS 13 Photos.app.
FloatingSwitch
A replication of a segmented control in the iOS 13 Photos.app.
Core Classes
-
FloatingSwitchView.swift
-
FloatingSwitchView.xib
-
FloatingSwitchSegment.swift
-
FloatingSwitchSegment.xib
Usage
- Install a custom view on Interface Builder.
- Assign the custom view class as
FloatingSwitchView
. - Set an appropriate layouts. In the default implementation of FloatingSwitch, the width follows the intrinsic size.
- Set segments with
setSegments(with:)
method. - Set
target
andaction
. Then you can catch control events when users switch segments.
See SampleViewController.swift
for usage.
License
See LICENSE for details.