Class
RangedDateInputFormLayout
public final class RangedDateInputFormLayout: LabelInputFormLayout
A LabelInputFormLayout
subclass that uses a DateInputFormLayout
for user input.
This is similar to the DateInputFormLayout
, but is used in cases where the use needs Ranged Selected on
the DatePicker.
Relationships
Superclass
LabelInputFormLayout
A layout used in forms for gathering input from a user.
Initializers
init()
required public init()
Properties
selectedDatesPublisher
public var selectedDatesPublisher: AnyPublisher<[Date]?, Never>
The currently selected date, if there is one, as a Publisher.
dateFormat
public var dateFormat: String = "MM/dd/yyyy"
The date format to use in the date formatter. Used to display the selected date in the field.
Methods
selectDates(_:)
public func selectDates(_ dates: [Date])
Sets the field to have a selected dates. This method is useful when you want to have the field default to a value.
This validates that the date passed in exists in the items property. If it does not, this does nothing.
Parameters
Name | Type | Description |
---|---|---|
dates | [Date] |
The date that should be selected. |
presentDatePicker(presenter:dateConfig:didSelectDates:)
public func presentDatePicker(
presenter: UIViewController,
dateConfig: DatePickerConfiguration,
didSelectDates: @escaping ([Date]?) -> Void
)
Call this method when you want to show the DatePicker, i.e when the view is tapped.
This will make the picker and then present it for you as a ModalDialog.
Parameters
Name | Type | Description |
---|---|---|
presenter | UIViewController |
The UIViewController to use to present the DatePicker. |
dateConfig | DatePickerConfiguration |
The configuration object to use to configure the DatePicker. |
didSelectDates | @escaping ([Date]?) -> Void |
Closure to pass the selected dates object. |