I am trying so as to add a easy DatePicker time selector in my SwiftUI app. The thought is to pick out the time of your subsequent appointment and calculate when you’ll want to depart.
Within the DatePicker you may choose the date ranges through the use of the in: startDate...endDate
performance so it could make sense to set the date vary to be:
let startDate = Date()
let endDate = Date(timeIntervalSinceNow: 24 * 3600.0)
however from what I can see, the time picker solely permits me to pick out the time from now till midnight tomorrow. What am I doing fallacious right here?
DatePicker("What time do you need to arrive at?", choice: $appointmentTimes.arrivalTime,
in: startDate...endDate,
displayedComponents: .hourAndMinute)
.labelsHidden()
.font(.largeTitle)
.datePickerStyle(.wheel)
.onAppear {
UIDatePicker.look().minuteInterval = 5
}
Replace:
Eradicating the show elements provides me a capability to indicate the date which might then work considerably appropriately, permitting me to pick out tomorrow occasions till now. However since I wish to preserve it easy, I’d reasonably have simply have it present the occasions.