Code Monkey home page Code Monkey logo

rkcalendar's Introduction

RKCalendar

RKCalendar is a SwiftUI Calendar / Date Picker for iOS.

Features include:

  • minimum and maximum calendar dates selectable,
  • single date selection,
  • range of dates selection,
  • multi-dates selection,
  • disabled dates setting.

Light Mode

demo app first screenshot demo app first screenshot

Dark Mode

demo app first screenshot demo app first screenshot

⚠️ WARNING ⚠️ This is an early version of this library that requires Swift 5.1 and Xcode 11

Requirements

  • iOS 13.0+
  • Xcode 11+
  • Swift 5.1+

Installation

Integrate RKCalendar into your project by including the files in the "Manager" group.

Usage

See ContenView.swift for some examples. Typically create a RKManager and pass it to a RKViewController.

Customise the RKManager for the desired effects as follows:

Calendar minimum and maximum date setting

Setting the calendar, minimum and maximum dates that can be selected.

RKManager(calendar: Calendar.current, minimumDate: Date(), maximumDate: Date().addingTimeInterval(60*60*24*365), mode: 0)

Single date selection

Use mode 0 to select a single date.

RKManager(calendar: Calendar.current, minimumDate: Date(), maximumDate: maxDate, mode: 0)

Range of dates selection

Use mode 1 to select a contiguous range of dates, from a start date to an end date.

RKManager(calendar: Calendar.current, minimumDate: Date(), maximumDate: maxDate, mode: 1)

Note, mode 2 is automatically toggled internally and the end date must be greater than the start date.

Multi-dates selection

Use mode 3 for selecting a number of dates.

RKManager(calendar: Calendar.current, minimumDate: Date(), maximumDate: maxDate, mode: 3)

Disabled-dates setting

Use any mode and set zero or more dates to be disabled (un-selectable).

For example:

var rkManager = RKManager(calendar: Calendar.current, minimumDate: Date(), maximumDate: maxDate, mode: 0)

rkManager.disabledDates.append(contentsOf: [
    Date().addingTimeInterval(60*60*24*4),
    Date().addingTimeInterval(60*60*24*5),
    Date().addingTimeInterval(60*60*24*7)
])

License

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

rkcalendar's People

Contributors

jdtzmn avatar raffikian avatar workingdog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rkcalendar's Issues

Swift Manifest File

I think being able to access this either through the swift package manager or pod would be a big improvement. It would also help developers stay updated on the latest version.

Lags on scroll

Hi, amazing job with this Library.

But i've noticed a big amount of lags during the vertical scroll.
I can't understand the reason, maybe too much logic and checks?

I will try to spend sometime to improve the performances but if you already tried something let me know please.

Selection Mode Unclear

I propose using an enumeration to make it directly obvious what mode the user currently has set.

Display only

I'd like to only view the calendar and not allow users to select dates unless in "edit" mode. Is that possible now? If not can you please add that ability?

Thanks for a great UI.

Custom color for a day

Great work with the calendar library. Is there any way to mark a day and mark the day with a specific color?

Week-view support.

It would be nice to support a week view format that can be embedded as a widget in other pages. (e.g. Activity app in iOS)

CHANGE LOCATION OF DAYS AND MONTH

Hi, I can't show the days and the month of the calendar in the languages where the phone is located, they are always and only in English, help?
Thank you! :)

Updates to RKCalendar

RaffiKian, great project.

I've made some modifications to your code to include xCode 11 beta 6, multi-dates selection, disabled dates option, etc... If you are interested in these I'd be happy to do another pull request. If not let me know.

https://github.com/workingDog/RKCalendar

Calendar does not start on current date when including dates from past

I suspect this is something to do with Lists in SwiftUI, but if you give the start date to the RKManager as a date in the past, the calendar starts at that date. I suspect most users desired behaviour would be the calendar always starts on the current date and then the user scrolls up or down to the section they want?

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.