Coder Social home page Coder Social logo

willsuo-github / expandingdatepicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fpotter/expandingdatepicker

0.0 0.0 0.0 873 KB

An NSDatePicker that expands to show a graphical calendar view when focused.

Home Page: https://fpotter.org/posts/expanding-date-picker/

License: MIT License

Ruby 5.66% Swift 94.34%

expandingdatepicker's Introduction

ExpandingDatePicker

Screenshot

CI Status Version License Platform

ExpandingDatePicker is a textual date picker that will expand to show a graphical date picker beneath it when focused. It has the same styling as the expandable date picker Apple uses in Calendar.app.

Installation

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

pod 'ExpandingDatePicker'

Usage (Programmatic)

ExpandingDatePicker extends NSDatePicker so the API is the same. Only catch is that it only works for year/month/day elements, in single picker mode and in the textField style.

import ExpandingDatePicker



let datePicker = ExpandingDatePicker(frame: .zero)
// Required settings...
datePicker.datePickerElements = .yearMonthDay
datePicker.datePickerMode = .single
datePicker.datePickerStyle = .textField
datePicker.sizeToFit()



view.addSubview(datePicker)

Usage (Interface Builder)

Use the Library to add a Date Picker to your view. In the Identity Inspector panel, set the custom class to ExpandingDatePicker.

Requirements

Deployment target of macOS 10.10+, though it has only been tested on 10.14.

Known Issues

  • When the field expands to show the graphical date picker, you'll notice that the traffic lights in your app's window will turn gray. The expansion is shown in an NSPanel (a special kind of NSWindow), and when that panel temporarily becomes the app's key window, the traffic lights go dark. Calendar.app's version of this expanded date picker doesn't have this problem because they use a private API.

Author

Fred Potter, [email protected]

License

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

expandingdatepicker's People

Contributors

fpotter avatar willsuo-github avatar

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.