EnterpriseDS Documentation

Class DSDate​Picker

@IBDesignable public final class DSDatePicker: UIView  

An Enterprise-styled date & time picker. This should be used when a user needs to select a date, time, or both a date and time.

For storyboards, add a UIView and change the class name to DSDatePicker.

Initialize and set properties as needed.

let picker = DSDatePicker(dateType: .datetime)

picker.datePickerDelegate = self
picker.labelText = "Appointment Schedule"
picker.date = Date()

Use a DSDatePickerDelegate to detect when its tapped so you can present the picker view. You can supply standard UIDatePicker options using DSDatePickerControlOptions.

func datePickerTapped(_ picker: DSDatePicker) {
    let options = DSDatePickerControlOptions()
    options.minimumDate = Date()

    picker.showDateSelection(on: navigationController, options: options)
}
DSDatePicker DSDatePicker UIView UIView DSDatePicker->UIView

Conforms To

UIView

Initializers

init(frame:​)

public override init(frame: CGRect)  

Properties

date​Picker​Delegate

@IBOutlet public weak var datePickerDelegate: DSDatePickerDelegate? 

The delegate which receives updates on the DSDatePicker's state.

date​Type

public var dateType: DSDatePickerDateType = .date  

The style of date & time selection desired.

date​Type​String

@IBInspectable public var dateTypeString: String  

The dateType property representable by a String.

This property is only recommended for use in the Attributes inspector of a storyboard since enums are not @IBInspectable. Possible values are date, time and datetime. In code, use the dateType property instead.

is​Enabled

@IBInspectable public var isEnabled: Bool = true  

Returns true if the component is enabled and allows changing the value.

label​Text

@IBInspectable public var labelText: String?  

The text to be displayed in the label.

date

public var date: Date?  

The date value of the field.

Methods

awake​From​Nib()

public override func awakeFromNib()  

prepare​For​Interface​Builder()

public override func prepareForInterfaceBuilder()  

show​Date​Selection(on:​options:​)

func showDateSelection(on viewController: UIViewController?, options: DSDatePickerControlOptions? = nil)  

Displays the date & time selection modal by presenting on a UIViewController.

Parameters

on UIView​Controller?

The UIViewController to push display the modal on