Simple customizable action sheet.
iOS 8.4+
To install DTActionSheet add a dependency to your Podfile:
pod "DTActionSheet"
To install DTActionSheet add a dependency to your Cartfile:
github "danjiang/DTActionSheet"
carthage update --platform ios
import DTActionSheet
Subclass following 3 classes with subtle differences:
- DTActionSheet - Full customizable
- DTDismissibleActionSheet - With dismiss button on the left
- DTSavableActionSheet - With dismiss button on the left and save button on the right
You can review source code of DTDatePickerSheet
to know how to write your own action sheet.
- DTDatePickerSheet - UIDatePicker in action sheet.
- More to come...
class ViewController: UIViewController {
private let formatter = DateFormatter()
override func viewDidLoad() {
super.viewDidLoad()
formatter.dateStyle = .short
}
@IBAction func changeDate(_ sender: UIButton) {
let sheet = DTDatePickerSheet(style: .dark)
sheet.setTitle("Choose Date")
sheet.configDatePicker(mode: .date, date: Date()) { [unowned self] date in
let title = self.formatter.string(from: date)
sender.setTitle(title, for: .normal)
}
sheet.show()
}
}