Giter Site home page Giter Site logo

monthyearpicker's Introduction

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 File โ†’ Swift Packages โ†’ Add 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.

monthyearpicker's People

Contributors

alexanderedge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

monthyearpicker's Issues

UI Bug in iOS 16

Using this with iOS 16, it's just showing the month and the year automatically is the current one

Doesn't work for IOS 16

Using this with iOS 16, it's just showing the month and the year automatically is the current one, in previous version there's no problem.

Bug with autolayout programatically

When initializing the view programatically by doing
let pickerView = MonthYearPickerView()
The autolayout system conflicts with the autoresizing mask, making the picker view not visible on the screen.
pickerView.autoresizingMask = [.flexibleWidth, .flexibleHeight]

Debug view hierarchy

Hi there. For some reason, if there is MonthYearPickerView on the screen I can't debug view hierarchy with the error attached, and I can't print hierarchy in XCTest as well
Screenshot 2021-12-10 at 23 05 43

Xcode 13.1
Framework version 4.0.3

Use case:
Just try to debug view hierarchy with MonthYearPickerView attached

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.