Giter Site home page Giter Site logo

vacalendar's Introduction

Screenshots

About Swift 4.2

The calendar with support for:

  • Horizontal and vertical swipe directions
  • Showing days out
  • Single and multi days selection
  • First weekday sunday or monday
  • Supplementary views
  • Localization

Example project

Take a look at the example project over here

Usage

In order to create calendar with horizontal scroll direction:

  1. Create storyboard with 2 UIViews
  2. Make the first one subclass of VAMonthHeaderView, it will represent the name of the month and the control buttons to switch between months

  1. Make the second view subclass of VAWeekDaysView, this view will display weekdays names

  1. I recommend that you specify your own calendar with the settings firstWeekday and timeZone to correctly display dates
let defaultCalendar: Calendar = {
    var calendar = Calendar.current
    calendar.firstWeekday = 1
    calendar.timeZone = TimeZone(secondsFromGMT: 0)!
    return calendar
}()
  1. Configure appearance of VAMonthHeaderView and VAWeekDaysView
    @IBOutlet weak var monthHeaderView: VAMonthHeaderView! {
        didSet {
            let appereance = VAMonthHeaderViewAppearance(
                previousButtonImage: #imageLiteral(resourceName: "previous"),
                nextButtonImage: #imageLiteral(resourceName: "next"),
                dateFormat: "LLLL"
            )
            monthHeaderView.delegate = self
            monthHeaderView.appearance = appereance
        }
    }
    
    @IBOutlet weak var weekDaysView: VAWeekDaysView! {
        didSet {
            let appereance = VAWeekDaysViewAppearance(symbolsType: .veryShort, calendar: defaultCalendar)
            weekDaysView.appearance = appereance
        }
    }
  1. Setup VACalendarView
    var calendarView: VACalendarView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let calendar = VACalendar(calendar: defaultCalendar)
        calendarView = VACalendarView(frame: .zero, calendar: calendar)
        calendarView.showDaysOut = true
        calendarView.selectionStyle = .multi
        calendarView.monthDelegate = monthHeaderView
        calendarView.dayViewAppearanceDelegate = self
        calendarView.monthViewAppearanceDelegate = self
        calendarView.calendarDelegate = self
        calendarView.scrollDirection = .horizontal
        view.addSubview(calendarView)
    }
    
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        
        if calendarView.frame == .zero {
            calendarView.frame = CGRect(
                x: 0,
                y: weekDaysView.frame.maxY,
                width: view.frame.width,
                height: view.frame.height * 0.6
            )
            calendarView.setup()
        }
    }

Release Notes

Version 1.0

  • Release version.

Version 1.3

  • Added ability to define own date format for VAMonthView's month header by @spase84
  • Localization
  • Swift 4.2

Requirements

  • Swift 4.0
  • Xcode 9
  • iOS 10.0+

Installation

use_frameworks!

pod 'VACalendar'

License

VACalendar is released under an MIT License. See LICENSE for details.

vacalendar's People

Contributors

binusz avatar jondwillis avatar spase84 avatar tobaloidee avatar vodolazkyi 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

vacalendar's Issues

Date Range Selection

Currently we can select single and multiple days but it will be great if you add range selection. like selecting all dates between 2 dates

Dates are off in the example

screenshot
May 2018 should have 31 days. The date selection and supplementaries seem to be off as well. Keep up the good work! This is one of the best looking calendar framework I've used.

Get month change callback when swiping left to right on calendar

I see that VAMonthHeaderViewDelegate provide callback when we change the month in calendar

but is there a way to get callback when we swipe months in calendar (left/right) indication if next or previous month is selected or disable the swiping functionality?

Work for only 1 year

Hi, I have installed pod in my project I have noticed that it work's for only one year which mean 12 month's for example: it present month is Dec ,2018. it is moving forward scroll for Nov 2019 only only a 12 months working. please resolve this issue asap

Current month won't show up.

Current month won't show up. Today is October 2 and the calendar don't display October even the end date is set for today using the Date()

Current month not showing properly

Hi,

I have one issue with the calendar that is when I open the calendar for first time in IST, it shows perfect current date and month but when someone open it in EST or other it shows one month previous.

So how can I fix this to make current date and month correct in all timezones?

Thanks.

How to delete all supplementaries?

Hi! When I receive a data I need to update calendar supplementaries, but if I received empty data and set supplementaries with the empty array, days not updated and dots are visible. How can I remove all dots if a data is empty? Thanks.

cocoapods are broken

```[!] No podspec found for VACalendar in `/Users/vodolazkyi/Desktop/VACalendar````

In general why does it contains vodolazkyi in path?

Set first week day to "Saturday"

I want to use VACalendar in Iran locale , in our locale calendar first day of week is Saturday . when I set calendar.firstWeekday = 0 app will crash.

Invalid Month display

Hi,
I'm using this library to show the calendar within my application but I have a problem to display the calendar in California, it's showing invalid months.

Screenshot 2019-07-17 at 6 26 11 PM

Disable future dates and specified dates

Hello there, thanks for creating this calendar.

Currently i am working on a project which the future dates need to be disabled. I also need to disable specified date (e.g 10 July 2018). I am using the CalendarPopUpView. I have read through the example codes but still couldn't implement what i wanted. It will be great if you can enlighten me.

Thank you.

highlight Dates

How to highlight the Dates in ViewDidLoad() because I am getting response as Date to highlight the date in Calendar. Any help please.

Logo Proposal

Good day @Vodolazkyi I am a graphic designer and i would like to propose a logo design for your good project. Ill be doing it for free if you will allow me..Thanks and best regards! - Tobaloidee

How to enable selection for showDaysOut

Hi @Vodolazkyi ,

By default showDaysOut (previous and next month dates in first and last week of calendar) was disabled for user selection and supplementary.

I have displayed dates calendarView.showDaysOut = true using this boolean.

But actually I need to enable selection and also need to add supplementaries for showDaysOut. Please help where i need to modify code to enable these feature.

Thanks in advance.

A proposal for dating in the library

Hi, your library is very good. I use your library in my application, and I have some problems. I need to send a request to the server with the date of the next (or previous) month, when the month has changed. And I can not find how. Can you suggest how to do this?

not display properly at iPhone SE screen

When I build in iPhone SE, the calendar display 6 days of week on main calendar.
Because, self.view doesn't know own width yet.
You need to update layout on every screen size changed.

Issue when calendar moved to particular month from one month

Hi,

I need to jump to month from one month by the date I get.

self.vaCalendarView.startDate = traversedDate
self.vaCalendarView.setup()

This is working fine where I can see that particular month. But the issue is dates font has got different. I am getting selected day state for unselected days and unselected for selected day. Because fonts got interchanged.

Will you please let me know how to jump from one month to other if I am doing wrong above.

Current Month not showing when we want previous year dates.

I have calculated dates like :

let startDate = Date()
let endDate = defaultCalendar.date(byAdding: .year, value: -1, to: Date())

let calendar = VACalendar(startDate: startDate, endDate: endDate, selectedDate: startDate, calendar: defaultCalendar)

let dates = DaysAvailability.some(getAvailableDates())
calendarView.setAvailableDates(dates)

please help asp.
thanks in advance.

MonthView doesn't use locale of calendar

Hi, your calendar is awesome, but i'm faced issue when trying to localize calendar, weekdays view and calendar view using locale given by created calendar, but month uses default locale. So, my question is:
How about add some localisation to appearance of MonthView?
Or maybe send instance with changeable month label when delegate method monthDidChange(_ currentMonth: Date) called.

Localization Issue

Hi there ! I've changed the calendar identifier to Persian and still CalendarView shows days in Georgian format( month and weekdays are ok with localization ). Is there any problem in days or i forgot something ?! - Thanks

How to get week start date while viewType is in week

Hi,

We can able to get month start date using monthDidChange delegate.

Is there possibility to get week start date when viewType = .week, currently it shows month start date only for both viewType = .month and viewType = .week

Current date selection

This is really not an issue but a suggestion.

I think it's good if the selection on the current date will stay even if I chose another date.

I can't seem to make a workaround outside the API (I'm new to Swift, sorry).

But then, big thanks for this.

How to get the calendar to appear

Hi,

I apologize if this is a stupid question (if it is, I would appreciate a response telling me so) but I'm new to swift and xcode and I downloaded your framework and followed the usage on the ReadMe by creating the storyboard with views etc but when I run the code, I do not see anything. It doesn't even take me to the storyboard, it just stays on the launch screen.

I know I need to make modifications to get specific features such as the views in your screenshots but I'm not sure what those modifications are and I would greatly appreciate if you could lead me in the right direction.

Thank you.

Delegate method "selectedDate(_ date: Date)" not called, if a day already selected.

I can't get a date, if a day already selected.
I think, nothing will be break if the method
calendarDelegate?.selectedDate?(day.date)
will call before the line
guard day.state == .available else { return }

original code:
` extension VACalendarView: VAMonthViewDelegate {

func dayStateChanged(_ day: VADay, in month: VAMonth) {
    switch selectionStyle {
    case .single:
        guard day.state == .available else { return }
        
        calendar.deselectAll()
        calendar.setDaySelectionState(day, state: .selected)
        calendarDelegate?.selectedDate?(day.date)
        
    case .multi:
        calendar.setDaySelectionState(day, state: day.reverseSelectionState)
    }
}

}`

Disable all past dates

Hi,

Thanks for such a great custom calendar. Can you please help me how to disable all the past dates disabled from the current date.

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.