A beautiful UIView wrapper for UIDatePicker. Requires iOS 13.2 or newer
Create a UIView
and set its custom class to RSDatePicker
and link it with a IBOutlet
in the class you want
let datePicker = RSDatePicker(frame: CGRect)
You can customize the date picker in multiple ways:
initialDate
sets the default dateminimumDate
sets the minimum selectable datemaximumDate
sets the maximum selectable datepickerMode
sets the date picker mode (.date
or time
)dateFormat
sets the date format for the visible labelcloseWhenSelectingDate
allows you to enable/disable closing after a date was pickedcloseAnimationDuration
controls the animation speed when closing the pickercalendarIconIsHidden
controls if the calendar icon is hiddencalendarIconSizeMultiplier
controls the multiplier of the aspect ratio of the calendar imageviewYou can change the margins (left/right/top/bottomMargin
) of the container view
There is also a callback for receiving the new picked date: didChangeDate
You can also get or set the current date whenever you need by using currentDate
RSDatePicker is available under the MPL-2.0 license. More info available here.
link |
Stars: 0 |
Last commit: 2 weeks ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics