DateRangePicker
public struct DateRangePicker
extension DateRangePicker: View
extension DateRangePicker: _ViewEmptyChecking
DateRangePicker
provides a title and value label with Fiori styling and a MultiDatePicker
.
Usage
@State var isRequired = false
@State var selectedRange1: ClosedRange<Date>? = Date.now...Date.init(timeIntervalSinceNow: 24 * 60 * 60 * 2)
@State var selectedRange2: ClosedRange<Date>? = Date.now...Date.init(timeIntervalSinceNow: 24 * 60 * 60 * 2)
@State var selectedRange3: ClosedRange<Date>? = Date.now...Date.init(timeIntervalSinceNow: 24 * 60 * 60 * 2)
@State var pickerVisible1 = false
@State var pickerVisible2 = false
@State var pickerVisible3 = false
@State var showsErrorMessage = false
@State var showAINotice: Bool = false
let customizedDateFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "dd-MM-yyyy"
return formatter
}()
DateRangePicker(title: "Range Selection1", isRequired: isRequired, selectedRange: $selectedRange1, pickerVisible: $pickerVisible1)
.informationView(isPresented: self.$showsErrorMessage, description: AttributedString("This is information hint message."))
.informationViewStyle(.informational)
.aiNoticeView(isPresented: self.$showAINotice, description: "AI Notice")
DateRangePicker(title: "Customized Date Formatter", mandatoryFieldIndicator: self.mandatoryFieldIndicator(), isRequired: self.isRequired, selectedRange: self.$selectedRange2, rangeFormatter: self.customizedDateFormatter, pickerVisible: self.$pickerVisible2)
.informationView(isPresented: self.$showsErrorMessage, description: AttributedString("This is information success message."))
.informationViewStyle(.success)
.aiNoticeView(isPresented: self.$showAINotice, description: "AI Notice")
DateRangePicker(title: "Custom Locale & Calendar", mandatoryFieldIndicator: self.mandatoryFieldIndicator(), isRequired: self.isRequired, selectedRange: self.$selectedRange3, pickerVisible: self.$pickerVisible3)
.informationView(isPresented: self.$showsErrorMessage, description: AttributedString("This is information hint message."))
.informationViewStyle(.informational)
.aiNoticeView(isPresented: self.$showAINotice, description: "AI Notice")
.environment(\.locale, Locale(identifier: "zh-Hans"))
.environment(\.calendar, Calendar(identifier: .gregorian))
-
init(title:
valueLabel: controlState: errorMessage: range: selectedRange: rangeFormatter: noRangeSelectedString: pickerVisible: componentIdentifier: ) Undocumented
Declaration
Swift
public init(@ViewBuilder title: () -> any View, @ViewBuilder valueLabel: () -> any View = { EmptyView() }, controlState: ControlState = .normal, errorMessage: AttributedString? = nil, range: Range<Date>? = nil, selectedRange: Binding<ClosedRange<Date>?> = .constant(nil), rangeFormatter: DateFormatter? = nil, noRangeSelectedString: String? = nil, pickerVisible: Binding<Bool>, componentIdentifier: String? = DateRangePicker.identifier)
-
Undocumented
Declaration
Swift
static let identifier: String
-
init(title:
valueLabel: mandatoryFieldIndicator: isRequired: controlState: errorMessage: range: selectedRange: rangeFormatter: noRangeSelectedString: pickerVisible: ) Undocumented
Declaration
Swift
init(title: AttributedString, valueLabel: AttributedString? = nil, mandatoryFieldIndicator: TextOrIcon? = .text("*"), isRequired: Bool = false, controlState: ControlState = .normal, errorMessage: AttributedString? = nil, range: Range<Date>? = nil, selectedRange: Binding<ClosedRange<Date>?>, rangeFormatter: DateFormatter? = nil, noRangeSelectedString: String? = nil, pickerVisible: Binding<Bool>)
-
Undocumented
Declaration
Swift
init(_ configuration: DateRangePickerConfiguration)
-
Declaration
Swift
@MainActor public var body: some View { get }
-
Undocumented
Declaration
Swift
public var isEmpty: Bool { get }