How to map Binding with optional value in SwiftUI
Issue #838 We can write our custom Binding import SwiftUI extension Binding where Value == Date? { func flatten(defaultValue: Date) -> Binding<Date> { Binding<Date>( get: { wrappedValue ?? defaultValue }, set: { wrappedValue = $0 } ) } } Then use in places where it needs Binding with non-optional value DatePicker( "", selection: $date.flatten(defaultValue: Date()), displayedComponents: .hourAndMinute ) .datePickerStyle(WheelDatePickerStyle())