ADDatePicker is Horizontal Date Picker Library written in Swift
Requirements
- iOS 10.0+
- Xcode 10.0+
- Swift 4.2+
Communication
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
CocoaPods 1.1+ is required
To integrate ADDatePicker into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'ADDatePicker'
end
Then, run the following command:
$ pod install
Usage
- First, set Custom Class of UIView to ADDatePicker...
..And That's it., you can run the project now. it's that simple. ;]
Demo
Customize with ease..!
Customization
"Listen up, Dave. Your code is poor and colour choices are even poorer. this doesn't look good"
"Calm Down Joe, I gotchu.."
@IBOutlet weak var datePicker: ADDatePicker!
1. Reset Range of years.
datePicker.yearRange(inBetween: 1990, end: 2022)
2. Set Intial Date to Picker.
datePicker.intialDate = Date()
3. Yay, Colours.. or Colors. (depends.. where you came from)
//set BackGround Color of DatePicker
datePicker.bgColor = .blue
//set Selection and Deselection Background Colors
datePicker.deselectedBgColor = .clear
datePicker.selectedBgColor = .white
//set Selection and Deselection Text Colors
datePicker.selectedTextColor = .black
datePicker.deselectTextColor = UIColor.init(white: 1.0, alpha: 0.7)
4. Customize Selector..
Currently, there are three selectionType available. you're most welcome to contribute if you want to extand this list.
enum SelectionType {
case square
case roundedsquare
case circle
}
You can change selector by writing this piece of code.
datePicker.selectionType = .circle
5. Delegate Methods..
Now, You can confirm to Delegate method to access date on scroll
datePicker.delegate = self
func ADDatePicker(didChange date: Date)
Which allows you to get new date on every scroll.
Credits
ADDatePicker is developed under observation of the great minds of Space-O Technology
License
ADDatePicker is released under the MIT license. See License for details.