ATHMultiSelectionSegmentedControl 0.2.2

ATHMultiSelectionSegmentedControl 0.2.2

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Nov 2017
SwiftSwift Version 3.2
SPMSupports SPM

Maintained by Thanos Theodoridis.



ATHMultiSelectionSegmentedControl

Logo

ATHMultiSelectionSegmentedControl is a UIView based control mimicking the API of UISegmentedControl but also allowing for multiple selection of segments. It’s fully battle and unit-tested. If you find any bugs or want to suggest improvements please feel free to contribute.

Demo

API

import ATHMultiSelectionSegmentedControl

// initialize empty segmented control
let segmentedControl = ATHMultiSelectionSegmentedControl()

// Add items to segmented control at once...
segmentedControl.insertSegmentsWithTitles(["Segment 1", "Segment 2", "Segment 3"])

// ... or one by one
segmentedControl.insertSegmentWithTitle("Segment 4", atIndex: 3, animated: true)

// Get and set items
segmentedControl.titleForSegmentAtIndex(0) // Segment 1
segmentControl.setTitle("Title", forSegmentAtIndex: 0)
segmentedControl.titleForSegmentAtIndex(0) // Title

// Enable or disable an option
segmentedControl.setEnabled(false, forSegmentAtIndex: 0) // "Title" segment is now disabled
segmentedControl.isEnabledForSegmentAtIndex(0) // false
segmentedControl.setEnabled(true, forSegmentAtIndex: 0) // "Title" segment is now enabled
segmentedControl.isEnabledForSegmentAtIndex(0) // true 

Example

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

Installation

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

pod "ATHMultiSelectionSegmentedControl"

Author

attheodo, [email protected]

License

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

Changelog

  • v0.1.0, May 2016
    • Initial release