Swiftpack.co - attheodo/ATHMultiSelectionSegmentedControl as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by attheodo.
attheodo/ATHMultiSelectionSegmentedControl 0.2.2
A Swifty segmented control that allows for multiple options selection
⭐️ 25
🕓 2 years ago
.package(url: "https://github.com/attheodo/ATHMultiSelectionSegmentedControl.git", from: "0.2.2")

ATHMultiSelectionSegmentedControl

CI Status Version License Platform Language

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

Compatibility

  • Use swift2.2 branch for Swift 2.2
  • Use master branch for Swift 3.0

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.2.0, September 2016
    • Migration to Swift 3.0
  • v0.1.1, July 2016
    • Bug fixes for tinting and button insertion
  • v0.1.0, May 2016
    • Initial release

GitHub

link
Stars: 25
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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