RealTimePicker
RealTimePicker is an elegant and customizable time picker written in Swift.
12-h format | 24-h format | Custom | Example Usage |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Installation
pod 'RealTimePicker', '0.0.4'
Usage
RealTimePickerView was designed over UIPickerView and can be used to pick time (hour, minute) with 24-h and 12-h format. Simply create RealTimePickerView()
in the same way you would expect to present UIPickerView
and use as a subview.
let view = RealTimePickerView(format: .h24, tintColor: .white)
view.timeLabelFont = UIFont.systemFont(ofSize: 44, weight: .semibold) // default size is 44
view.colonLabelFont = UIFont.systemFont(ofSize: 44 * 0.75, weight: .bold) // default size
view.formatLabelFont = UIFont.systemFont(ofSize: 24, weight: .semibold) // default size is 24
view.backgroundColor = UIColor.white.withAlphaComponent(0.9)
view.showCurrentTime = true
view.layer.cornerRadius = 24
Use updateDateTime(_ date: Date)
function in order to set default time to picker view.
Sample App
Check out the Sample App for more complex configurations of RealTimePickerView
, including how to change hour format, time components and apply layout constaints.
License
RealTimePicker is released under a MIT License. See LICENSE file for details. Requires iOS 11+ and is compatible with Swift 4+ projects.