RZGDayOfWeekPicker is an iOS control for selecting days of the week built entirely with Swift.
To use RZGDayOfWeekPicker simply clone/download this repo and then drag RZGDayOfWeekPicker.swift into your Xcode Project.
- selectedColor: The color that appears when a day of the week is selected
- unselectedColor: The color that appears when a day of the week is not selected
- textColor: The color of the text
- fontSize: The size of the text
- spacing: The spacing between each day
Create the DayOfWeekPicker either through code or storyboard.
You can then directly interact with the picker using these methods
func dayIsSelectedAtIndex(index: Int) -> Bool
func indexOfSelectedDays() -> [Int]
func selectDayWithIndex(index: Int)
func deselectDayWithIndex(index: Int)
or set your controller to be the pickers delegate to receive messages whenever items are selected or deselected
override func viewDidLoad() {
super.viewDidLoad()
picker.delegate = self
}
func dayWasSelected(picker: RZGDayOfWeekPicker, selectedIndex: Int) {
print(picker.indexOfSelectedDays())
}
func dayWasDeselected(picker: RZGDayOfWeekPicker, deselectedIndex: Int) {
print(picker.indexOfSelectedDays())
}