How can I customize an UIDatePicker to only show 2 hours?

How can I customize an UIDatePicker to show: mm:dd:yyyy and the time with only two options to choose from: hh1 or hh2: (07) hrs or (22)hrs?


example: (scrollable) Date: May 23 2020 Time: 0700 (option 1)

2200 (option 2)

The only parameters I know are:


Temporal Attributes


var maximumDate: Date?

The maximum date that a date picker can show.


var minimumDate: Date?

The minimum date that a date picker can show.


var minuteInterval: Int

The interval at which the date picker should display minutes.


So, you can set minimumDate to May 23 2020 Time: 0700 and

maximumDate to May 23 2020 Time: 2200


You can hide the minutes, but you will get each hour in between.


So the simplest is to use a normal picker and configure with these 2 values (pretty easy and much more flexible).

How can I customize an UIDatePicker to only show 2 hours?
 
 
Q