๐ Inline/Expanding date picker for table views.
DatePickerCell is available as a Swift Package. You can add it to your project in Xcode:
- Go to File โ Add Package Dependencies
- Enter the repository URL:
https://github.com/DylanVann/DatePickerCell.git - Choose the version and add to your target
Or add it to your Package.swift file:
dependencies: [
.package(url: "https://github.com/DylanVann/DatePickerCell.git", from: "1.0.9")
]Import the library and use DatePickerCell in your table views:
import DatePickerCell
class ViewController: UITableViewController {
let datePickerCell = DatePickerCell(style: .default, reuseIdentifier: "DatePickerCell")
override func viewDidLoad() {
super.viewDidLoad()
datePickerCell.leftLabel.text = "Start Date"
datePickerCell.date = Date()
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return datePickerCell
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return datePickerCell.datePickerHeight()
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
datePickerCell.selectedInTableView(tableView)
}
}