Swiftpack.co - alexanderedge/MonthYearPicker as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by alexanderedge.
alexanderedge/MonthYearPicker 4.0.3
A UIControl subclass for selecting a date using a month and a year
⭐️ 22
🕓 1 year ago
iOS
.package(url: "https://github.com/alexanderedge/MonthYearPicker.git", from: "4.0.3")

MonthYearPicker

Version License Platform

This is a UIControl subclass that allows date selection using month and year, unlike UIDatePicker which displays year, month, and day. This makes MonthYearPicker useful for credit card expiry dates, for example. It is locale-aware and shows localised values. It also supports Dynamic Type and dark mode where available.

Light Dark
Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-03 at 19 20 08 Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-03 at 19 20 13

Usage

Initialise MonthYearPicker in the same way you would a UIPickerView instance.

let picker = MonthYearPickerView(frame: CGRect(origin: CGPoint(x: 0, y: (view.bounds.height - 216) / 2), size: CGSize(width: view.bounds.width, height: 216)))
picker.minimumDate = Date()
picker.maximumDate = Calendar.current.date(byAdding: .year, value: 10, to: Date())
picker.addTarget(self, action: #selector(dateChanged(_:)), for: .valueChanged)
view.addSubview(picker)

Requirements

iOS 9.0 or later

Installation

MonthYearPicker is available through CocoaPods or Swift Package Manager.

CocoaPods

Add the following line to your Podfile:

pod "MonthYearPicker", '~> 4.0.2'

Swift Package Manager

From within Xcode, select FileSwift PackagesAdd Package Dependency... and enter https://github.com/alexanderedge/MonthYearPicker.git.

Author

Alexander Edge, [email protected]

License

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

GitHub

link
Stars: 22
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Related Packages

Release Notes

3 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics