Swiftpack.co - Package - HeshamMegid/HMSegmentedControl
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.


Pod Version Carthage compatible Pod Platform Pod License

A highly customizable drop-in replacement for UISegmentedControl, used by more than 22,000 apps, including TikTok, PayPal, Imgur and Bleacher Report.


  • 📸 Supports both text and images
  • ↕️ Multiple sizing and selection styles
  • 📜 Horizontal scrolling for an infinite number of segments
  • ⚙️ Advanced title styling with text attributes for font, color, kerning, shadow, etc
  • 🖥 Compatible with both Swift and Objective-C
  • 📱 Updated for Xcode 11, iOS 13 and Swift 5. Supports all the way back to iOS 7!


pod 'HMSegmentedControl'

Installation via Carthage is also supported..


The code below will create a segmented control with the default looks:

let segmentedControl = HMSegmentedControl(sectionTitles: [

segmentedControl.frame = CGRect(x: 0, y: 0, width: 100, height: 40)
segmentedControl.addTarget(self, action: #selector(segmentedControlChangedValue(segmentedControl:)), for: .valueChanged)

Included is a demo project showing how to fully customize HMSegmentedControl.

Possible Styles

Apps Using HMSegmentedControl

If you are using HMSegmentedControl in your app or know of an app that uses it, please add it to this list.

Need Help?

If you need help with HMSegmentedControl, or with iOS/Swift development in general, check out swiftmentor.io


HMSegmentedControl is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

If this code was helpful, I would love to hear from you.



Stars: 3756


1.5.6 - 2020-05-11T16:09:36

Various bug fixes.

1.5.4 - 2017-05-20T14:49:22

Fixes Xcode 8.3 compatibility issues.

1.5.3 - 2016-09-17T17:24:42

Fixes compatibility issues with iOS 10.

1.5.1 - 2015-03-30T15:20:26

  • Fixes issues #91, #92, #95 and #97.

1.5 - 2015-03-03T13:43:50

  • Adds advanced styling support for default and selected state with ability to customize kerning, shadow, stroke color and width, ligature, baseline offset, paragraph style, etc.
  • A few of the control style attributes can now be customized using UIAppearance.
  • Adds ability to specify a border type, color and width.
  • Drops support for older iOS versions. Now works with iOS 7 and above.
  • Lots of bug fixes.

1.4 - 2014-08-14T12:07:28

  • Lots of bug fixes
  • Add AutoLayout support
  • Adds HMSegmentedControlSelectionStyleArrow
  • Adds support for non-animated selections.
  • Adds support for custom box layer opacity.
  • Add support for multi-line labels on iOS 7+
  • Updated documentation in header file

1.3.0 - 2013-11-19T08:03:05

  • Introducing horizontal scrolling via scrollEnabled property. Check example project
  • Adds XIB/Storyboard support
  • Fixes deprecations when building with iOS 7 SDK
  • Updates example project to support iOS 7
  • Code refactoring and cleanup