CreationKit Documentation

Class Date​Input​Form​Layout

public final class DateInputFormLayout: LabelInputFormLayout  

A LabelInputFormLayout subclass that uses a DateInputFormLayout for user input.

DateInputFormLayout DateInputFormLayout LabelInputFormLayout LabelInputFormLayout DateInputFormLayout->LabelInputFormLayout

Superclass

LabelInputFormLayout

A layout used in forms for gathering input from a user.

Initializers

init()

required public init()  

Properties

selected​Item​Publisher

public var selectedItemPublisher: AnyPublisher<String?, Never>  

The currently selected item, if there is one, as a Publisher.

selected​Date​Publisher

public var selectedDatePublisher: AnyPublisher<Date?, Never>  

The currently selected date, if there is one, as a Publisher.

selected​Item

public var selectedItem: String?  

The currently selected item, if there is one.

selected​Date

public var selectedDate: Date?  

date​Format

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

select​Date(_:​)

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

date Date

The date that should be selected.

set​Date(_:​)

public func setDate(_ dateString: String)  

present​Date​Picker(presenter:​date​Config:​did​Select​Date:​)

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

presenter UIView​Controller

The UIViewController to use to present the DatePicker.

date​Config Date​Picker​Configuration

The configuration object to use to configure the DatePicker.

did​Select​Date @escaping (Date?) -> Void

Closure to pass the selected date object.