Here we are going to learn UIDatePicker in swift :-
The Date Picker in iOS 8 provides an custom Picker View that uses multiple rotating wheels to allow users to select dates and times. In this tutorial the current selected date is presented onscreen inside a label. This tutorial is written in Swift so you will need Xcode 6. It can be downloaded at Apple's developer portal.
Open Xcode and create a new Single View Application. For product name, use UIDatePickerSwift and then fill out the Organization Name (ex. jogendra) and Organization Identifier (Ex. com.jogendra.datePicker) with your customary values. Enter Swift as Language and make sure only iPhone/iPad/Universal is selected in Devices.
Drag a UILabel or UITextField (According to your requirement ) to the View Controller change the UILabel or UITextField text to "Select Date". Next, drag a Date Picker to the View Controller and center it. The Storyboard should look like this.
Create object of both UIDatePickerView and UITextField :-
}class ViewController: UIViewController {@IBOutletvar textField:UITextField!@IBOutletvar datePickerObj:UIDatePicker!
And Make action of UIDatePickerView
@IBAction func datePickerClicked( datePicker:UIDatePicker){}
Connect in Storyboard
After doing these steps do work in function of datepicker for change value
@IBAction func datePickerClicked( datePicker:UIDatePicker){var dateFormatter = NSDateFormatter()dateFormatter.dateStyle = NSDateFormatterStyle.FullStylevar dateStr = dateFormatter.stringFromDate(datePicker.date)textField.text = dateStr}
It's look like this :-
Thanks for Visit , Also can visit on My blog Facebook page iPhone & iPad Application Development Help World and also can visit Google+