-1

I have one collection view in which i have to add multiple cell with different UI without Creating XIB

how can i create it

Sarthak
  • 33
  • 4

1 Answers1

4

You can use the property maximumDate of UIDatePicker. Whenever user changes the startDatePicker, set the maximumDate of endDatePicker to 30 mins more than the start. You can do this in the target for valueChanged action of startDatePicker.

startDatePicker.addTarget(self, action: #selector(startDatePickerValueChanged), for: .valueChanged)

Your startDatePickerValueChanged function can be

@objc func startDatePickerValueChanged() {
    let newStartDate = startDatePicker.date
    endDatePicker.maximumDate = newStartDate.add(component: .minute, value: 30)!
}
Pawan
  • 90
  • 2
  • 6