MultiSelectSegmentedControl alternatives and similar libraries
Based on the "Switch" category.
Alternatively, view MultiSelectSegmentedControl alternatives based on common mentions on social networks and blogs.
-
HMSegmentedControl
A highly customizable drop-in replacement for UISegmentedControl. -
RAMPaperSwitch
:octocat: ๐ RAMPaperSwitch is a Swift material design UI module which paints over the parent view when the switch is turned on. iOS library by @Ramotion -
BetterSegmentedControl
An easy to use, customizable replacement for UISegmentedControl & UISwitch. -
DGRunkeeperSwitch
Runkeeper design switch control -
TwicketSegmentedControl
Custom UISegmentedControl replacement for iOS, written in Swift -
SevenSwitch
iOS7 style drop in replacement for UISwitch -
AIFlatSwitch
Nicely animated flat design switch alternative to UISwitch -
SJFluidSegmentedControl
A segmented control with custom appearance and interactive animations. Written in Swift 3.0. -
TKSwitcherCollection
An animation switch collection -
PinterestSegment
A Pinterest-like segment control with masking animation. -
AKASegmentedControl
๐ซ Fully customizable Segmented Control for iOS -
LUNSegmentedControl
Customizable segmented control with interactive animation. -
ViralSwitch
A UISwitch that infects its superview with its tint color. -
JTMaterialSwitch
A Customizable Switch UI for iOS, Inspired from Google's Material Design -
DynamicMaskSegmentSwitch
A segment switcher with dynamic text mask effect -
AnimatedSwitch
UISwitch which paints over the parent view with the color in Swift. -
Switcher
Swift - Custom UISwitcher with animation when change status -
Switch
๐ An iOS switch control implemented in Swift with full Interface Builder support -
YUSegment
A customizable Segmented Control for iOS. Supports text and image.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of MultiSelectSegmentedControl or a related project?
README
MultiSelectSegmentedControl
UISegmentedControl remake that supports selecting multiple segments, vertical stacking, combining text and images.
Features
- [x] Single or multiple selection.
- [x] Horizontal or vertical stacking.
- [x] Can show text and images together.
- [x] Use from either storyboard or code.
- [x] UIAppearance support.
Usage
Very similar to UISegmentedControl
, can be used as a drop-in replacement in most cases.
If you use Interface Builder, add a regular UIView
and then set its class to MultiSelectSegmentedControl
.
SwiftUI Usage
MultiSegmentPicker(
selectedSegmentIndexes: $indexSet,
items: ["One", "Two", image, [image2, "Text"], "Last"]
)
The properties mentioned below can be passed as arguments to the MultiSegmentPicker
initializer, or used as view modifiers (e.g., .borderWidth(3)
).
Creating Segments
Each segment can contain an image, a text, or both:
let multiSelect = MultiSelectSegmentedControl()
multiSelect.items = ["One", "Two", image, [image2, "Text"], "Last"]
Images are shown in full color (unlike UISegmentedControl
). To make them render in the same tintColor
as the control, use template mode:
multiSelect.items = [image1, image2, image3].map { $0.withRenderingMode(.alwaysTemplate) }
Selecting Segments
multiSelect.selectedSegmentIndexes = [1, 2, 4]
Or just single selection:
multiSelect.allowsMultipleSelection = false
multiSelect.selectedSegmentIndex = 3
Getting Selected Segments
let selectedIndices: IndexSet = multiSelect.selectedSegmentIndexes
Or to get the titles:
let titles: [String] = multiSelect.selectedSegmentTitles
Handling User Selection Changes
You can use standard target-action:
multiSelect.addTarget(self, action: #selector(selectionChanged), for: .valueChanged)
Or conform to the delegate protocol:
extension MyViewController: MultiSelectSegmentedControlDelegate {
func multiSelect(_ multiSelectSegmentedControl: MultiSelectSegmentedControl, didChange value: Bool, at index: Int) {
print("selected \(value) at \(index)")
}
}
... and set the delegate:
multiSelect.delegate = self
Changing Appearance
Color:
multiSelect.tintColor = .green
Background Color (optional - use if background color should be different from tint color):
multiSelect.selectedBackgroundColor = .blue
Shape:
multiSelect.borderWidth = 3 // Width of the dividers between segments and the border around the view.
multiSelect.borderRadius = 32 // Corner radius of the view.
Stack the segments vertically:
multiSelect.isVertical = true
Stack each segment contents vertically when it contains both image and text:
multiSelect.isVerticalSegmentContents = true
Text styling:
multiSelect.setTitleTextAttributes([.foregroundColor: UIColor.yellow], for: .selected)
multiSelect.setTitleTextAttributes([.obliqueness: 0.25], for: .normal)
More label styling:
multiSelect.titleConfigurationHandler = {
$0.numberOfLines = 0
$0.lineBreakMode = .byWordWrapping
}
Installation
CocoaPods:
pod 'MultiSelectSegmentedControl'
Swift Package Manager:
dependencies: [
.package(url: "https://github.com/yonat/MultiSelectSegmentedControl", from: "2.3.6")
]
TODO
- [ ] foreground color of selected segment should be/appear transparent
- [ ] configure segment
layoutMargins
,stackView.spacing
Meta
*Note that all licence references and agreements mentioned in the MultiSelectSegmentedControl README section above
are relevant to that project's source code only.