An easy to use, customizable replacement for UISegmentedControl & UISwitch.

Overview

BetterSegmentedControl

Version License Platform




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

Features

  • 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!

Examples

iOS

Demo

iPad cursor

Demo

Requirements

  • iOS 9.0+
  • Xcode 8+

Installation

Swift Package Manager

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

CocoaPods

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'

Manually

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

Usage

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

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.

Contribution

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

Logo by Guillaume Galante.

Author

George Marmaridis

License

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

Comments
  • Add support for index = UISegmentedControl.noSegment

    Add support for index = UISegmentedControl.noSegment

    First of all, thanks for a great package!

    This is a quick fix that allows index to be set to UISegmentedControl.noSegment.

    Whenever thats the case we hide the indicatorView. We also disable animations for going from or to noSegment.

    Fixes #88, fixes #37 and fixes #10

    Thanks again!

    opened by fredriks 8
  • Allow control to be deselected

    Allow control to be deselected

    Hello, I have a use-case to allow a new user to select his/her gender. I want the control to be initially deselected to prevent the user from skipping the setup screen with the default "Male" option. SO an empty option would help force the user to select an option. UISegmentedControl allows this:

    control.selectedSegmentIndex = UISegmentedControlNoSegment
    

    perhaps you could allow index and setIndex() to accept -1 as an exception. This is common standard for indexes.

    opened by simoami 6
  • Update Info.plist reference (fixes build issue)

    Update Info.plist reference (fixes build issue)

    Updates Info.plist reference to point to actual file

    Had to manually edit this as Xcode couldn't find the plist file, gets things building again but I'm not so familiar enough with CocoaPods to know exactly how it got in to this state to begin with. (see #105)

    opened by gverdouw 5
  • numberOfLines is not available in latest version

    numberOfLines is not available in latest version

    With the latest version, ability to change numberOfLines is removed as I see. I was able to use it with version 0.8.

    After I looked to the code I found the way below for setting it. It's not the ideal way I guess but it works for me 😄

    for element in segmentedControl.segments {
          ((element as! LabelSegment).normalView as! UILabel).numberOfLines = 2
          ((element as! LabelSegment).selectedView as! UILabel).numberOfLines = 2
    }
    

    Is there any more preferred way for doing this, if so can you please guide me?

    Thanks already.

    opened by mkeremkeskin 5
  • Unable to add custom views to IndicatorView

    Unable to add custom views to IndicatorView

    I'm not sure if this is a feature you are interested in supporting, but my team maintains an in-house fork to be able to add subviews to the indicatorView to support UI that isn't provided.

    In our case, we have a view which behaves as an "underline" for the currently selected index and moves along with the indicator view. If we decide to do something different, we can always just change our custom view to look however we want.

    The change required to support this is changing the access modifier of the indicatorView property and the IndicatorView class to public. Of course, you could always code in accessors like addSubviewToIndicator or something similar.

    Let me know what you think - if this is something you are interested in supporting, I'd be happy to submit a pull request

    opened by amorde 5
  • Scrolling blocked on selected index

    Scrolling blocked on selected index

    I'm putting BetterSegmentedControl in a table cell.

    If I try to scroll the table up-and-down while my fingertip is on the selected option ("Option C" in the screenshot), then the scrolling is blocked. This happens whether panningDisabled is true or false.

    better

    opened by cannyboy 5
  • Prevent pan gesture recognizer to start when panning is disabled

    Prevent pan gesture recognizer to start when panning is disabled

    Prevent pan gesture recognizer to start when panning is disabled

    It also allow scrolling when the better segmented control is placed inside a scroll view and the panning is disabled on the segmented control

    opened by Valgrin 4
  • [!] CocoaPods could not find compatible versions for pod

    [!] CocoaPods could not find compatible versions for pod "BetterSegmentedControl":

    `` [!] CocoaPods could not find compatible versions for pod "BetterSegmentedControl": In Podfile: BetterSegmentedControl (~> 1.1)

    None of your spec sources contain a spec satisfying the dependency: BetterSegmentedControl (~> 1.1).

    You have either:

    • mistyped the name or version.
    • not added the source repo that hosts the Podspec to your Podfile. ``

    If I remove version info, it downloads, but version 1.0.3

    opened by SubZane 4
  • Different font size for normal and selected cause title stack

    Different font size for normal and selected cause title stack

    image image

    //------------------------------Setup Segmented Control------------------------------
            indicatorControl = BetterSegmentedControl(
                frame: CGRect(x: 0.0, y: 0.0, width: segementedControl.bounds.width, height: 40),
                segments: LabelSegment.segments(withTitles: ["全部".localized, "未拜访".localized,"进行中".localized,"已完成".localized],
                                                normalFont: UIFont.systemFont(ofSize: 14),
                                                normalTextColor: #colorLiteral(red: 0.9759296775, green: 0.976655066, blue: 0.9794365764, alpha: 1),
                                                selectedFont: UIFont.systemFont(ofSize: 16),
                                                selectedTextColor: #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)),
                index: 0,
                options: [.backgroundColor(.clear),
                          .indicatorViewInset(0)
                ])
            
            indicatorControl.autoresizingMask = [.flexibleWidth]
            indicatorControl.addTarget(self, action: #selector(segementValueChanged(_:)), for: .valueChanged)
            
            let customSubview = UIView(frame: CGRect(x: 0, y: 36, width: 40, height: 4.0))
            customSubview.backgroundColor = UIColor(hex:"#EF5350")
            customSubview.autoresizingMask = [.flexibleLeftMargin, .flexibleRightMargin]
            indicatorControl.addSubviewToIndicator(customSubview)
            segementedControl.addSubview(indicatorControl)
    
    opened by icefox57 4
  • Titles can get cut off, make font size adjust automatically.

    Titles can get cut off, make font size adjust automatically.

    I'm having an issue, on some devices, the titles can get cut off, and the rest is replaced with three dots. If width is limited, can the font size automatically become smaller to compensate? UILabels already are able to do this, there is an option in Storyboards.

    opened by dannymout 4
  • add announceImmediately property

    add announceImmediately property

    It sometimes makes sense to trigger .ValueChanged on tap, rather than wait for the control to slide into place. The announceImmediately property does this.

    (please ignore the podfile stuff)

    opened by cannyboy 4
  • is it possible to have space inbetween the segments

    is it possible to have space inbetween the segments

    image

    Is there a way to use this control and have padding in between the selected and normal views? My intent is to make it appear as if there are three buttons. I can always programmatically just make three buttons but this would be a cleaner solution.

    opened by naterock101 0
  • Bump nokogiri from 1.10.10 to 1.13.9

    Bump nokogiri from 1.10.10 to 1.13.9

    Bumps nokogiri from 1.10.10 to 1.13.9.

    Release notes

    Sourced from nokogiri's releases.

    1.13.9 / 2022-10-18

    Security

    Dependencies

    • [CRuby] Vendored libxml2 is updated to v2.10.3 from v2.9.14.
    • [CRuby] Vendored libxslt is updated to v1.1.37 from v1.1.35.
    • [CRuby] Vendored zlib is updated from 1.2.12 to 1.2.13. (See LICENSE-DEPENDENCIES.md for details on which packages redistribute this library.)

    Fixed

    • [CRuby] Nokogiri::XML::Namespace objects, when compacted, update their internal struct's reference to the Ruby object wrapper. Previously, with GC compaction enabled, a segmentation fault was possible after compaction was triggered. [#2658] (Thanks, @​eightbitraptor and @​peterzhu2118!)
    • [CRuby] Document#remove_namespaces! now defers freeing the underlying xmlNs struct until the Document is GCed. Previously, maintaining a reference to a Namespace object that was removed in this way could lead to a segfault. [#2658]

    sha256 checksums:

    9b69829561d30c4461ea803baeaf3460e8b145cff7a26ce397119577a4083a02  nokogiri-1.13.9-aarch64-linux.gem
    e76ebb4b7b2e02c72b2d1541289f8b0679fb5984867cf199d89b8ef485764956  nokogiri-1.13.9-arm64-darwin.gem
    15bae7d08bddeaa898d8e3f558723300137c26a2dc2632a1f89c8574c4467165  nokogiri-1.13.9-java.gem
    f6a1dbc7229184357f3129503530af73cc59ceba4932c700a458a561edbe04b9  nokogiri-1.13.9-x64-mingw-ucrt.gem
    36d935d799baa4dc488024f71881ff0bc8b172cecdfc54781169c40ec02cbdb3  nokogiri-1.13.9-x64-mingw32.gem
    ebaf82aa9a11b8fafb67873d19ee48efb565040f04c898cdce8ca0cd53ff1a12  nokogiri-1.13.9-x86-linux.gem
    11789a2a11b28bc028ee111f23311461104d8c4468d5b901ab7536b282504154  nokogiri-1.13.9-x86-mingw32.gem
    01830e1646803ff91c0fe94bc768ff40082c6de8cfa563dafd01b3f7d5f9d795  nokogiri-1.13.9-x86_64-darwin.gem
    8e93b8adec22958013799c8690d81c2cdf8a90b6f6e8150ab22e11895844d781  nokogiri-1.13.9-x86_64-linux.gem
    96f37c1baf0234d3ae54c2c89aef7220d4a8a1b03d2675ff7723565b0a095531  nokogiri-1.13.9.gem
    

    1.13.8 / 2022-07-23

    Deprecated

    • XML::Reader#attribute_nodes is deprecated due to incompatibility between libxml2's xmlReader memory semantics and Ruby's garbage collector. Although this method continues to exist for backwards compatibility, it is unsafe to call and may segfault. This method will be removed in a future version of Nokogiri, and callers should use #attribute_hash instead. [#2598]

    Improvements

    • XML::Reader#attribute_hash is a new method to safely retrieve the attributes of a node from XML::Reader. [#2598, #2599]

    Fixed

    ... (truncated)

    Changelog

    Sourced from nokogiri's changelog.

    1.13.9 / 2022-10-18

    Security

    Dependencies

    • [CRuby] Vendored libxml2 is updated to v2.10.3 from v2.9.14.
    • [CRuby] Vendored libxslt is updated to v1.1.37 from v1.1.35.
    • [CRuby] Vendored zlib is updated from 1.2.12 to 1.2.13. (See LICENSE-DEPENDENCIES.md for details on which packages redistribute this library.)

    Fixed

    • [CRuby] Nokogiri::XML::Namespace objects, when compacted, update their internal struct's reference to the Ruby object wrapper. Previously, with GC compaction enabled, a segmentation fault was possible after compaction was triggered. [#2658] (Thanks, @​eightbitraptor and @​peterzhu2118!)
    • [CRuby] Document#remove_namespaces! now defers freeing the underlying xmlNs struct until the Document is GCed. Previously, maintaining a reference to a Namespace object that was removed in this way could lead to a segfault. [#2658]

    1.13.8 / 2022-07-23

    Deprecated

    • XML::Reader#attribute_nodes is deprecated due to incompatibility between libxml2's xmlReader memory semantics and Ruby's garbage collector. Although this method continues to exist for backwards compatibility, it is unsafe to call and may segfault. This method will be removed in a future version of Nokogiri, and callers should use #attribute_hash instead. [#2598]

    Improvements

    • XML::Reader#attribute_hash is a new method to safely retrieve the attributes of a node from XML::Reader. [#2598, #2599]

    Fixed

    • [CRuby] Calling XML::Reader#attributes is now safe to call. In Nokogiri <= 1.13.7 this method may segfault. [#2598, #2599]

    1.13.7 / 2022-07-12

    Fixed

    XML::Node objects, when compacted, update their internal struct's reference to the Ruby object wrapper. Previously, with GC compaction enabled, a segmentation fault was possible after compaction was triggered. [#2578] (Thanks, @​eightbitraptor!)

    1.13.6 / 2022-05-08

    Security

    • [CRuby] Address CVE-2022-29181, improper handling of unexpected data types, related to untrusted inputs to the SAX parsers. See GHSA-xh29-r2w5-wx8m for more information.

    ... (truncated)

    Commits
    • 897759c version bump to v1.13.9
    • aeb1ac3 doc: update CHANGELOG
    • c663e49 Merge pull request #2671 from sparklemotion/flavorjones-update-zlib-1.2.13_v1...
    • 212e07d ext: hack to cross-compile zlib v1.2.13 on darwin
    • 76dbc8c dep: update zlib to v1.2.13
    • 24e3a9c doc: update CHANGELOG
    • 4db3b4d Merge pull request #2668 from sparklemotion/flavorjones-namespace-scopes-comp...
    • 73d73d6 fix: Document#remove_namespaces! use-after-free bug
    • 5f58b34 fix: namespace nodes behave properly when compacted
    • b08a858 test: repro namespace_scopes compaction issue
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Custom BetterSegmentedControlSegment

    Custom BetterSegmentedControlSegment

    Hi, I wanted to create new custom BetterSegmentedControlSegment to be used. It is a simple view that has both an icon on the left and a label on the right. I've conformed to the protocol. But whenever I try to use it, the new segments don't populate the sections correctly and get all into the first section. Also the it doesn't layout in the center.

    Has anyone tried creating a custom BetterSegmentedControlSegment and can you share what you did and what worked?

    Thanks

    opened by lussvontrier 0
  • Bump tzinfo from 1.2.7 to 2.0.5

    Bump tzinfo from 1.2.7 to 2.0.5

    Bumps tzinfo from 1.2.7 to 2.0.5.

    Release notes

    Sourced from tzinfo's releases.

    v2.0.5

    • Changed DateTime results to always use the proleptic Gregorian calendar. This affects DateTime results prior to 1582-10-15 and any arithmetic performed on the results that would produce a secondary result prior to 1582-10-15.
    • Added support for eager loading all the time zone and country data by calling either TZInfo::DataSource#eager_load! or TZInfo.eager_load!. Compatible with Ruby On Rails' eager_load_namespaces. #129.
    • Ignore the SECURITY file from Arch Linux's tzdata package. #134.

    TZInfo v2.0.5 on RubyGems.org

    v2.0.4

    • Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.

    TZInfo v2.0.4 on RubyGems.org

    v2.0.3

    • Added support for handling "slim" format zoneinfo files that are produced by default by zic version 2020b and later. The POSIX-style TZ string is now used calculate DST transition times after the final defined transition in the file. #120.
    • Fixed TimeWithOffset#getlocal returning a TimeWithOffset with the timezone_offset still assigned when called with an offset argument on JRuby 9.3.
    • Rubinius is no longer supported.

    TZInfo v2.0.3 on RubyGems.org

    v2.0.2

    • Fixed 'wrong number of arguments' errors when running on JRuby 9.0. #114.
    • Fixed warnings when running on Ruby 2.8. #113.

    TZInfo v2.0.2 on RubyGems.org

    v2.0.1

    • Fixed "SecurityError: Insecure operation - require" exceptions when loading data with recent Ruby releases in safe mode. #100.
    • Fixed warnings when running on Ruby 2.7. #109.
    • Added a TZInfo::Timezone#=~ method that performs a regex match on the time zone identifier. #99.
    • Added a TZInfo::Country#=~ method that performs a regex match on the country code.

    TZInfo v2.0.1 on RubyGems.org

    v2.0.0

    Added

    • to_local and period_for instance methods have been added to TZInfo::Timezone. These are similar to utc_to_local and period_for_utc, but take the UTC offset of the given time into account.
    • abbreviation, dst?, base_utc_offset and observed_utc_offset instance methods have been added to TZInfo::Timezone, returning the abbreviation, whether daylight savings time is in effect and the UTC offset of the time zone at a specified time.
    • A TZInfo::Timestamp class has been added. It can be used with TZInfo::Timezone in place of a Time or DateTime.
    • local_time, local_datetime and local_timestamp instance methods have been added to TZInfo::Timezone. These methods construct local Time, DateTime and TZInfo::Timestamp instances with the correct UTC offset and abbreviation for the time zone.
    • Support for a (yet to be released) version 2 of tzinfo-data has been added, in addition to support for version 1. The new version will remove the (no longer needed) DateTime parameters from transition times, reduce memory consumption and improve the efficiency of loading timezone and country indexes.
    • A TZInfo::VERSION constant has been added, indicating the TZInfo version number.

    Changed

    • The minimum supported Ruby versions are now Ruby MRI 1.9.3, JRuby 1.7 (in 1.9 or later mode) and Rubinius 3.
    • Local times are now returned using the correct UTC offset (instead of using UTC). #49 and #52.
    • Local times are returned as instances of TimeWithOffset, DateTimeWithOffset or TZInfo::TimestampWithOffset. These classes subclass Time, DateTime and TZInfo::Timestamp respectively. They override the default behaviour of the base classes to return information about the observed offset at the indicated time. For example, the zone abbreviation is returned when using the %Z directive with strftime.
    • The transitions_up_to, offsets_up_to and strftime instance methods of TZInfo::Timezone now take the UTC offsets of given times into account (instead of ignoring them as was previously the case).
    • The TZInfo::TimezonePeriod class has been split into two subclasses: TZInfo::OffsetTimezonePeriod and TZInfo::TransitionsTimezonePeriod. TZInfo::OffsetTimezonePeriod is returned for time zones that only have a single offset. TZInfo::TransitionsTimezonePeriod is returned for periods that start or end with a transition.

    ... (truncated)

    Changelog

    Sourced from tzinfo's changelog.

    Version 2.0.5 - 19-Jul-2022

    • Changed DateTime results to always use the proleptic Gregorian calendar. This affects DateTime results prior to 1582-10-15 and any arithmetic performed on the results that would produce a secondary result prior to 1582-10-15.
    • Added support for eager loading all the time zone and country data by calling either TZInfo::DataSource#eager_load! or TZInfo.eager_load!. Compatible with Ruby On Rails' eager_load_namespaces. #129.
    • Ignore the SECURITY file from Arch Linux's tzdata package. #134.

    Version 2.0.4 - 16-Dec-2020

    • Fixed an incorrect InvalidTimezoneIdentifier exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.

    Version 2.0.3 - 8-Nov-2020

    • Added support for handling "slim" format zoneinfo files that are produced by default by zic version 2020b and later. The POSIX-style TZ string is now used calculate DST transition times after the final defined transition in the file. #120.
    • Fixed TimeWithOffset#getlocal returning a TimeWithOffset with the timezone_offset still assigned when called with an offset argument on JRuby 9.3.
    • Rubinius is no longer supported.

    Version 2.0.2 - 2-Apr-2020

    • Fixed 'wrong number of arguments' errors when running on JRuby 9.0. #114.
    • Fixed warnings when running on Ruby 2.8. #113.

    Version 2.0.1 - 24-Dec-2019

    • Fixed "SecurityError: Insecure operation - require" exceptions when loading data with recent Ruby releases in safe mode. #100.
    • Fixed warnings when running on Ruby 2.7. #109.
    • Added a TZInfo::Timezone#=~ method that performs a regex match on the time zone identifier. #99.
    • Added a TZInfo::Country#=~ method that performs a regex match on the country code.

    Version 2.0.0 - 26-Dec-2018

    ... (truncated)

    Commits
    • d9b289e Preparing v2.0.5.
    • 264c763 Add v0.3.61 and v1.2.10 from the 0.3 and 1.2 branches.
    • ca29f34 Fix relative path loading tests.
    • c4f177c Add a top level eager_load! method for Rails compatibility.
    • 94be919 Support preloading all data from a DataSource.
    • fe7ad26 Clarify that both files and directories are excluded.
    • d2883cf Tidy up of security file ignoring.
    • 6a4766e Merge pull request #133.
    • 5d53b59 Workaround for 'Permission denied - NUL' errors with JRuby on Windows.
    • 83450a1 ignore SECURITY file for Arch tzdata package
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(2.0.1)
  • 2.0.1(Oct 21, 2020)

    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

    Fixes

    • 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

    Other

    • 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)
    Source code(tar.gz)
    Source code(zip)
  • 1.3.0(Nov 10, 2019)

    • You can now integrate BetterSegmentedControl via Swift Package Manager
    • Index change animation duration & damping are now customizable
    • Add convenient class variable for getting a control that resembles the native iOS 13 UISegmentedControl
    • Fix issue that was preventing shadows to be added for the indicator view
    • Fix issue with corner radius and indicator insets
    • Update for Swift 5.1
    • Minor formatting improvements here and there
    Source code(tar.gz)
    Source code(zip)
  • 1.2(Jun 12, 2019)

    • Right to left languages support
    • Number of lines now supported in label segments
    • Index is no longer UInt, but Int, like Apple recommends
    • Formatting fixes here and there
    • Minimum required iOS version bumped from 8.0 to 9.0
    Source code(tar.gz)
    Source code(zip)
  • 1.0(Jul 22, 2018)

    This release adds support for any kind of segments. As a first addition, IconSegment has been added, in addition to the LabelSegment that was previously supported by default.

    Additionally, tests have been completely rewritten and are now Snapshot tests.

    Several minor usability and formatting updates.

    Source code(tar.gz)
    Source code(zip)
  • 0.9(Oct 4, 2017)

  • 0.8(Apr 26, 2017)

    Adds more customizability options:

    • titleNumberOfLines controls the number of lines of the title labels
    • addSubviewToIndicator(_ view: UIView) adds subviews to the indicator view

    Thanks to @amorde and @PoissonBallon for making this happen!

    Source code(tar.gz)
    Source code(zip)
  • 0.7(Dec 18, 2016)

    • Adds 4 new public properties for customizing borders: indicatorViewBorderWidth, indicatorViewBorderColor, titleBorderWidth, titleBorderColor
    • Minor performance improvements
    • Formatting / naming improvements
    Source code(tar.gz)
    Source code(zip)
  • 0.6(Dec 17, 2016)

    • Added property for announcing value immediately rather than waiting for animations to complete. This is now the default behavior.
    • Carthage shared scheme fix.
    Source code(tar.gz)
    Source code(zip)
  • 0.4(Jun 26, 2016)

Owner
George Marmaridis
iOS at @traderepublic, formerly @olx-global, @eyeem, @taxibeat
George Marmaridis
Custom UISegmentedControl replacement for iOS, written in Swift

TwicketSegmentedControl Custom UISegmentedControl replacement for iOS, written in Swift, used in the Twicket app. It handles the inertia of the moveme

Pol Quintana 1.7k Dec 31, 2022
UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images.

MultiSelectSegmentedControl UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images. Feature

Yonat Sharon 286 Dec 15, 2022
MacSegmentedControl - UISegmentedControl on macOS

Mac Segmented Control An implementation of iOS' UISegmentedControl on macOS. Add

Jeff Dlouhy 0 Dec 30, 2021
Customizable segmented control with interactive animation.

LUNSegmentedControl Purpose LUNSegmentedControl is control designed to let developers use segmented control with custom appearance, customizable inter

Stormotion 346 Dec 25, 2021
AKASegmentedControl is a fully customizable Segmented Control for iOS

#AKASegmentedControl AKASegmentedControl is a fully customizable Segmented Control for iOS ##Preview ##Usage Installation CocoaPods You can use CocoaP

Ali Karagoz 389 Sep 1, 2022
A customizable Segmented Control for iOS. Supports text and image.

YUSegment 中文文档 A customizable segmented control for iOS. Features Supports both (Attributed)text and image Supports show separator Supports hide indic

YyGgQq 112 Jun 10, 2022
A highly customizable drop-in replacement for UISegmentedControl.

HMSegmentedControl A highly customizable drop-in replacement for UISegmentedControl, used by more than 22,000 apps, including TikTok, PayPal, Imgur an

Hesham Abd-Elmegid 3.9k Dec 21, 2022
Custom UISegmentedControl replacement for iOS, written in Swift

TwicketSegmentedControl Custom UISegmentedControl replacement for iOS, written in Swift, used in the Twicket app. It handles the inertia of the moveme

Pol Quintana 1.7k Dec 31, 2022
iOS7 style drop in replacement for UISwitch

SevenSwitch iOS7 style drop in replacement for UISwitch Usage Cocoapods pod 'SevenSwitch', '~> 2.1' Swift support was added in version 2.0. If your p

Ben Vogelzang 779 Sep 5, 2022
A replacement for as which runs in constant time instead of O(n) when the conformance is not satisfiedA replacement for as which runs in constant time instead of O(n) when the conformance is not satisfied

ZConform A replacement for as? which runs in constant time instead of O(n) when the conformance is not satisfied. How it works ZConform does a one-tim

Emerge Tools 20 Aug 4, 2022
UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images.

MultiSelectSegmentedControl UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images. Feature

Yonat Sharon 286 Dec 15, 2022
UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images.

MultiSelectSegmentedControl UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images. Feature

Yonat Sharon 286 Dec 15, 2022
UISwitch which paints over the parent view with the color in Swift.

AnimatedSwitch Swift subclass of the UISwitch which paints over the parent view with the color if switch is turned on and returns original superview b

Alex Sergeev 248 Jul 26, 2022
A UISwitch that infects its superview with its tint color.

UISwitch subclass that 'infects' the parent view with the onTintColor when the switch is turned on. Inspired by this Dribble by Ramotion. Screenshot I

Andrea Mazzini 337 Sep 12, 2022
Nicely animated flat design switch alternative to UISwitch

AIFlatSwitch A smooth, nice looking and IBDesignable flat design switch for iOS. Can be used instead of UISwitch. Inspired by Creativedash's Dribbble

null 963 Jan 5, 2023
MacSegmentedControl - UISegmentedControl on macOS

Mac Segmented Control An implementation of iOS' UISegmentedControl on macOS. Add

Jeff Dlouhy 0 Dec 30, 2021
CollectionViewSegmentedControl - Scrollable UISegmentedControl built using a UICollectionView

CollectionViewSegmentedControl Installation CocoaPods Download CocoaPods Run 'Po

James Sedlacek 7 Nov 24, 2022
A rapid prototype of UISwitch built with Swift and PaintCode.

LTJelloSwitch A cute UISwitch prototype built in about 8 hours. One of my co-worker gave me this concept last year. It was written in Objective-C and

Lex Tang 366 Aug 5, 2022
The missing UIKit component. A scrollable alternative to UISegmentedControl

Requirements iOS 15.0 and higher Installation Swift Package Manager: dependencies: [ .package(url: "https://github.com/hugo-pivaral/UITabControl.git

Hugo Pivaral 11 Nov 18, 2022
(Animate CSS) animations for iOS. An easy to use library of iOS animations. As easy to use as an easy thing.

wobbly See Wobbly in action (examples) Add a drop of honey ?? to your project wobbly has a bunch of cool, fun, and easy to use iOS animations for you

Sagaya Abdulhafeez 150 Dec 23, 2021