Class
DateInputFormLayout
public final class DateInputFormLayout: LabelInputFormLayout
A LabelInputFormLayout
subclass that uses a DateInputFormLayout
for user input.
Relationships
Superclass
LabelInputFormLayout
A layout used in forms for gathering input from a user.
Initializers
init()
required public init()
Properties
selectedItemPublisher
public var selectedItemPublisher: AnyPublisher<String?, Never>
The currently selected item, if there is one, as a Publisher.
selectedDatePublisher
public var selectedDatePublisher: AnyPublisher<Date?, Never>
The currently selected date, if there is one, as a Publisher.
selectedDate
public var selectedDate: Date?
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
selectDate(_:)
public func selectDate(_ date: Date)
Sets the field to have a selected date. 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 |
---|---|---|
date | Date |
The date that should be selected. |
setDate(_:)
public func setDate(_ dateString: String)
presentDatePicker(presenter:dateConfig:didSelectDate:)
public func presentDatePicker(
presenter: UIViewController,
dateConfig: DatePickerConfiguration,
didSelectDate: @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. |
didSelectDate | @escaping (Date?) -> Void |
Closure to pass the selected date object. |