CalendarDateRangePickerViewController 0.1.0

CalendarDateRangePickerViewController 0.1.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Oct 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Miraan Tabrez.



  • By
  • miraan

CalendarDateRangePickerViewController




Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

It’s as simple as:

let dateRangePickerViewController = CalendarDateRangePickerViewController(collectionViewLayout: UICollectionViewFlowLayout())
dateRangePickerViewController.delegate = self
let navigationController = UINavigationController(rootViewController: dateRangePickerViewController)
self.navigationController?.present(navigationController, animated: true, completion: nil)

Just implement the delegate methods:

protocol CalendarDateRangePickerViewControllerDelegate {
    func didTapCancel()
    func didTapDoneWithDateRange(startDate: Date!, endDate: Date!)
}

You can also set additional options to override the defaults:

dateRangePickerViewController.minimumDate = Date()
dateRangePickerViewController.maximumDate = Calendar.current.date(byAdding: .year, value: 2, to: Date())
dateRangePickerViewController.selectedStartDate = Date()
dateRangePickerViewController.selectedEndDate = Calendar.current.date(byAdding: .day, value: 10, to: Date())

Installation

CalendarDateRangePickerViewController is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'CalendarDateRangePickerViewController'

Author

miraan, [email protected]

License

CalendarDateRangePickerViewController is available under the MIT license. See the LICENSE file for more info.