Date picker dialogue not showing when called from didSelectRowAtIndexPath delegate function of UITableView.
HI,
I refferred you example and added the DatePicker component in my project. Now I want to show when the user taps on cell and select the date. However the DatePickerDialogue is not showing. Here is my implementation
let datePicker = DatePickerDialog( textColor: .darkText, buttonColor: .systemBlue, font: UIFont.boldSystemFont(ofSize: 17), showCancelButton: true )
func datePickerTapped() { let currentDate = Date() var dateComponents = DateComponents() dateComponents.month = 6 let threeMonthAgo = Calendar.current.date(byAdding: dateComponents, to: currentDate)
datePicker.show("Set Activation Date",
doneButtonTitle: "Done",
cancelButtonTitle: "Cancel",
minimumDate: currentDate,
maximumDate: threeMonthAgo,
datePickerMode: .date) { (date) in
if let dt = date {
let formatter = DateFormatter()
formatter.dateFormat = "MM/dd/yyyy"
**//want to call an API of the date selected**
}
}
}
datePickerTapped() called from DidSelectRowAtIndexPath
Can you tell me what I am doing wrong? I referred your example and the difference is I dont want to add textField.