Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rudifa/ios-optionsetcontrol
A custom UIControl, presents buttons linked to values of an enum.
https://github.com/rudifa/ios-optionsetcontrol
Last synced: 24 days ago
JSON representation
A custom UIControl, presents buttons linked to values of an enum.
- Host: GitHub
- URL: https://github.com/rudifa/ios-optionsetcontrol
- Owner: rudifa
- License: mit
- Created: 2020-06-23T15:24:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-03T15:22:05.000Z (over 4 years ago)
- Last Synced: 2024-10-06T01:41:24.104Z (about 1 month ago)
- Language: Swift
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OptionSetControl
ShareOptionsPicker is a custom control that presents a group of option buttons.
How to add an instance to a ViewController
1. in .storyboard add a View, set its class to ShareOptionsPicker and add constraints
2. in .storyboard -> ViewController attach a @IBOutlet weak var optionsPicker
3. in .storyboard -> ViewController attach an @IBAction that will be called when the user clicks one of the control's buttons
4. in ViewController.viewDidLoad call optionsPicker.setupButtons(buttonsPerRow: 2)
The number of buttons and systemNames of their icons are defined by an enum like ShareOption.
Call to setupButtons adds buttons to the ShareOptionsPicker view.See also
[Protocol OptionSet](https://developer.apple.com/documentation/swift/optionset)
[How to Work With Bitmasks in Swift](https://cocoacasts.com/how-to-work-with-bitmasks-in-swift)
[How to Create a Custom Control Using a Bitmask](https://cocoacasts.com/how-to-create-a-custom-control-using-a-bitmask)
[HowToCreateACustomControlUsingABitmask](https://github.com/bartjacobs/HowToCreateACustomControlUsingABitmask)
[Option Set](https://nshipster.com/optionset/) shows an alternative approach.