Home > Mobile >  DatePicker ClosedRange in SwiftUI
DatePicker ClosedRange in SwiftUI

Time:10-11

How do I set DatePicker in SwiftUI in such a way that the user cannot select a date and time from the past? They should be able to select dates and times from now and in the future.

Thanks in advance.

CodePudding user response:

Set range to DatePicker like this:

DatePicker("Please enter a date", selection: $wakeUp, in: Date.now...)
  • Related