Quick and easy date picker.
You can install MDatePickerView in several ways:
Add source files to your project.
pod 'MDatePickerView'
import MDatePickerView
lazy var MDate : MDatePickerView = {
let mdate = MDatePickerView()
mdate.Color = .gray
mdate.delegate = self
mdate.from = 1980
mdate.to = 2100
return mdate
}()
Adopt the MDatePickerViewDelegate protocol in your view controller, e.g.
extension ViewController : MDatePickerViewDelegate {
func mdatePickerView(selectDate: Date) {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy - MM - dd"
let date = formatter.string(from: selectDate)
Label.text = date
}
}
MDatePickerView is distributed under the MIT license. See LICENSE for details.