Swiftpack.co - gmarm/BetterSegmentedControl as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by gmarm.
gmarm/BetterSegmentedControl 2.0.1
An easy to use, customizable replacement for UISegmentedControl & UISwitch.
⭐️ 2,165
🕓 46 weeks ago
.package(url: "https://github.com/gmarm/BetterSegmentedControl.git", from: "2.0.1")


Version License Platform

BetterSegmentedControl is an easy to use, customizable replacement for UISegmentedControl and UISwitch written in Swift.


  • ☑ Can be used as a segmented control or switch
  • ☑ Plethora of customizable options from colors to insets, radii and animations
  • ☑ Use text or icons as segments, or add your own custom segments
  • ☑ Designable straight in Interface Builder
  • ☑ Accessibility support
  • ☑ iPad cursor support
  • ☑ Customizable behavior
  • ☑ Right-to-left languages support
  • ☑ Fully tested

Check the latest release notes here!




iPad cursor



  • iOS 9.0+
  • Xcode 8+


Swift Package Manager

BetterSegmentedControl is available through Swift Package Manager. To install it, simply go to Xcode under File > Swift Packages > Add Package Dependency...


BetterSegmentedControl is available through CocoaPods. To install it, simply add the following line to your Podfile:

# Swift 5.1
pod 'BetterSegmentedControl', '~> 2.0'

# Swift 4
pod 'BetterSegmentedControl', '1.0'

# Swift 3 / Objective-C
pod 'BetterSegmentedControl', '0.8'


If you prefer not to use CocoaPods or Swift Package Manager, you can integrate BetterSegmentedControl into your project manually.


let control = BetterSegmentedControl(frame: CGRect(x: 16.0,
                                                   y: 0,
                                                   width: view.bounds.width - 32.0,
                                                   height: 44.0))

You can find several ways of using it, such as by designing it in a Storyboard file or creating it in code in the example project.

To run the example project, clone the repo, and run pod install from the Example directory first.


Feel free to submit Pull Requests or send me your feedback and suggestions!

Logo by Guillaume Galante.


George Marmaridis


BetterSegmentedControl is available under the MIT license. See the LICENSE file for more info.


Stars: 2166
Last commit: 46 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Release 2.0
3 years ago

Release notes

New features

  • Support for single segment, no segments
  • Support for no selected segment
  • Support for customizing .valueChanged behavior when calling setIndex()
  • iPad cursor support (iOS 13.4+)
  • Auto-sizing support when using Auto Layout
  • Improved accessibility / VoiceOver


  • Fix Interface Builder / runtime color inconsistencies
  • Fix accessibility labels being read twice
  • Fix warnings in pod and example
  • Cover edge cases when setting index / segments


  • Fully cover control with unit and snapshot tests
  • Add Slather support for calculating code coverage
  • Restructure internally for better readability and performance
  • Improve example view controller
  • Add logo and improve README with new demo GIFs

Breaking changes

  • When calling setIndex(), the .valueChanged event will now not be triggered by default. Use setIndex()'s shouldSendValueChangedEvent parameter to control this behavior
  • Default IB colors have been updated to match system's UISegmentedControl
  • Setting segments will now reset the index (no .valueChanged event will be triggered)

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics