Skip to content

A replication of a segmented control in the iOS 13 Photos.app.

License

Notifications You must be signed in to change notification settings

usagimaru/FloatingSwitch

Repository files navigation

FloatingSwitch

A replication of a segmented control in the iOS 13 Photos.app.

Demo Image: Light Mode Demo Image: Dark Mode

Demo.mp4

Core Classes

  • FloatingSwitchView.swift
  • FloatingSwitchView.xib
  • FloatingSwitchSegment.swift
  • FloatingSwitchSegment.xib

Usage

  1. Install a custom view on Interface Builder.
  2. Assign the custom view class as FloatingSwitchView.
  3. Set an appropriate layouts. In the default implementation of FloatingSwitch, the width follows the intrinsic size.
  4. Set segments with setSegments(with:) method.
  5. Set target and action. Then you can catch control events when users switch segments.

See SampleViewController.swift for usage.

License

See LICENSE for details.

About

A replication of a segmented control in the iOS 13 Photos.app.

Topics

Resources

License

Stars

Watchers

Forks

Languages