WheelPicker is ...
- Pure-SwiftUI picker like iOS standard wheel style picker
- No UIKit views are used internally, so it works smoothly with animated SwiftUI views.
- You can also add it to macOS projects.
- Various selection styles are available
- Circular style
- Finite style
- Infinite style (ex. used to select a date)
- Custumizable item label
- Formatting display text as you like
- Changing text color, font, or size
- Complex labels with Image, Shape, etc...
import WheelPicker
struct ContentView: View {
@State private var circularWheelPickerSelection: Int = 0
@State private var finiteWheelPickerSelection: Int = 0
@State private var dateWheelPickerSelection: Date = Date()
let items: [Int] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
var body: some View {
VStack {
// Circular style picker
CircularWheelPicker(selection: $circularWheelPickerSelection, items: items) { value in
// value may be nil (If the label is out of range)
if let value = value {
Text("\(value)")
} else {
Text("")
}
}
// Finite style picker
FiniteWheelPicker(selection: $finiteWheelPickerSelection, items: items) { value in
// value may be nil (If the label is out of range)
if let value = value {
Text("\(value)")
} else {
Text("")
}
}
// Date select picker (Multiple columns)
DateWheelPicker(selection: $dateWheelPickerSelection) { date in
let components = Calendar.current.dateComponents([.weekday], from: date)
switch components.weekday {
case 1: return .red // Sunday
case 7: return .blue // Saturday
default: return nil
}
}
}
}
}
- iOS 14.0+
- macOS 11.0+
- Xcode 12.0+
- If you want to contribute please feel free to submit pull requests.
- If you have a feature request please open an issue.
- If you found a bug or need help please check older issues, FAQ and threads on StackOverflow (Tag 'WheelPicker') before submitting an issue.
Before contribute check the CONTRIBUTING file for more info.
Follow these 3 steps to run Example project: clone WheelPicker repository, open WheelPicker workspace and run the Example project.
https://github.com/tokiensis/WheelPicker.git
pod 'WheelPicker-SwiftUI', '~> 1.0.0'
github "tokiensis/WheelPicker" ~> 1.0.0
You can do it by conforming to .....
See CHANGELOG.