WeekdayPicker is a custom UIDatePicker with weekdays.
- iOS 9.0+
- Xcode 9+
- Swift 4.0+
- If you'd like to ask a general question, use Stack Overflow.
- 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.
You can choose one of theses options to install WeekdayPicker.
📦 CocoaPods — CocoaPods is a library dependencies for Xcode projects.
[CocoaPods Installation](https://guides.cocoapods.org/using/getting-started.html#getting-started)To integrate WeekdayPicker into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target '<Your Target Name>' do
pod 'WeekdayPicker', '~> 0.1'
end
Then, run the following command:
$ pod install
💉 Carthage — Carthage is a decentralized dependency manager for Cocoa.
[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate WeekdayPicker into your Xcode project using Carthage, specify it in your Cartfile
:
github "WeekdayPicker/WeekdayPicker" ~> 4.7
Run carthage update
to build the framework and drag the built WeekdayPicker.framework
into your Xcode project.
📚 Swift Package Manager — Package manager for the Swift.
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler. It is in early development, but WeekdayPicker does support its use on supported platforms.
Once you have your Swift package set up, adding WeekdayPicker as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/Maximelc/WeekdayPicker.git", from: "1.0.0")
]
If you prefer to not use any of the dependency managers, you can integrate WeekdayPicker into your project manually.
After adding the framework to your project, import the module.
import WeekdayPicker
Add WeekdayPicker programmatically 🤓
// Initialization
let myPicker: WeekdayPicker = WeekdayPicker()
// Add delegation conformance
myPicker.delegated = self
// Apply frame
myPicker.frame = CGRect(origin: CGPoint(x: 0, y: 150),
size: CGSize(width: self.view.frame.size.width,
height: 150))
// The first date to show will be the current date
myPicker.setToDate(Date())
// Add picker to current view
self.view.addSubview(myPicker)
Implement WeekdayPickerDelegate 🤝
// MARK: - WeekdayPickerDelegate
extension <#MyViewController#>: WeekdayPickerDelegate {
func weekdayPickerDateChanged(_ date: Date?) {
if let changedDate = date {
print("\(changedDate)")
}
}
}
The full documentation is available here.
WeekdayPicker is released under the MIT license. See LICENSE for details.