Skip to content
Date picker dialog for iOS
Swift Ruby
Branch: master
Clone or download
Latest commit 33764b5 Jul 23, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
DatePickerDialog.xcodeproj Code cleanup and swift 5 Jul 8, 2019
Demo Code cleanup and swift 5 Jul 8, 2019
Sources Prevent objc warning Jul 8, 2019
Tests Adapted to xcode 9 beta 5 and Swift 4. Applied minor changes to remov… Aug 28, 2017
images Version 1.0 Stable Jan 5, 2015
.gitignore Add .DS_Store to .gitignore Jun 14, 2016
DatePickerDialog.podspec Update version Jul 23, 2019
README.mdown Update readme Jul 8, 2019


DatePickerDialog 3.0- iOS - Swift

DatePickerDialog is an iOS drop-in classe that displays an UIDatePicker within an UIAlertView.


DatePickerDialog works on iOS 7, 8 and 9, 10, 11 and 12. It depends on the following Apple frameworks, which should already be included with most Xcode templates:

  • Foundation
  • UIKit

Swift Versions

  • Swift 5.0 (Current)
  • Swift 4.2 (2.1 tag)
  • Swift 4.2 (2.0 tag)
  • Swift 2.3 (swift_2.3 branch)



You can use CocoaPods to install DatePickerDialog by adding it to your Podfile:

platform :ios, '8.0'
pod 'DatePickerDialog'

To get the full benefits import DatePickerDialog wherever you import UIKit

import UIKit
import DatePickerDialog


Create a Cartfile that lists the framework and run carthage bootstrap. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/DatePickerDialogFramework.framework to an iOS project.

github "squimer/DatePickerDialog-iOS-Swift"


  1. Download and drop DatePickerDialog.swift in your project.
  2. Congratulations!


	func datePickerTapped() {
		DatePickerDialog().show(title: "DatePicker", doneButtonTitle: "Done", cancelButtonTitle: "Cancel", datePickerMode: .date) {
			(date) -> Void in
			if let dt = date {
                		let formatter = DateFormatter()
                		formatter.dateFormat = "MM/dd/yyyy"
                		self.textField.text = formatter.string(from: dt)

Dialog parameters

  • showCancelButton: Bool - default true
  • locale: Locale? - default nil

Example without 'Cancel' button:

DatePickerDialog(showCancelButton: false).show(title: "DatePicker", doneButtonTitle: "Done", datePickerMode: .date)

Example with custom locale:

DatePickerDialog(locale: Locale(identifier: "es_PY")).show(title: "DatePicker", doneButtonTitle: "Done", datePickerMode: .date)

Show parameters

  • title: String (Required)
  • doneButtonTitle: String
  • cancelButtonTitle: String
  • defaultDate: Date
  • minimumDate: Date
  • maximumDate: Date
  • datePickerMode: UIDatePickerMode (Required)
  • callback: ((date: Date) -> Void) (Required)

Special thanks to


This code is distributed under the terms and conditions of the MIT license.

You can’t perform that action at this time.