Calendar View - It's lightweight and simple control with supporting Locale and CalendarIdentifier.

Overview

iOS Calendar

Version License Platform CocoaPods CocoaPods

It's lightweight and simple control with supporting Locale and CalendarIdentifier. There're samples for iPhone and iPad, and also with using a popover.
alt tag alt tag
Using popover:

alt tag

How to install

Manual:

Add to your project the next source files:

CalendarView.h
CalendarView.m
NSDate+CalendarView.h
NSDate+CalendarView.m
NSString+CalendarView.h
NSString+CalendarView.m

CocoaPods:

pod 'Calendar-iOS'

How to use

You can add view in the Interface Builder and set class to CalendarView or create in the code:

CalendarView *calendarView = [[CalendarView alloc] initWithPosition:10.0 y:10.0];
[self.view addSubview:calendarView];

So, it's all, you should see the calendar view.
This component was created for iPhone/iPod resolution, for iPad its works, but it looks really small, if it's necessary, you can play with static constants in the CalendarView.m, and maybe in future, will be done the scaling.
This calendar has some modes:

typedef NS_ENUM(NSInteger, CalendarMode)
{
    CalendarModeDefault,
    CalendarModeMonthsAndYears,
    CalendarModeYears
};

Default - there're days, months and years, the user can change months with help swipe gesture or pinch gesture for transitions in the calendar
MonthsAndYears - available months and years
Years - only years

There are external methods to mimic the swiping behavior in case a different UI is desired. However, these events will be logged with a different event type than swiping.

There are also some options for display:

// Whether the currently selected date should be marked
@property (nonatomic, assign) BOOL shouldMarkSelectedDate;
// Whether today's date should be marked
@property (nonatomic, assign) BOOL shouldMarkToday;
// Whether the month and year headers should be shown
@property (nonatomic, assign) BOOL shouldShowHeaders;
// Preferred weekday start
- (void)setPreferredWeekStartIndex:(NSInteger)index;

Date Markers - Default behavior is to mark the currently selected date and not today, but this can be customized to suit your needs. If both are marked and coincide on the same day, it will show up with the current selection color, not today's color.
Headers - Default behavior is to show the headers, but they can also be hidden, in which case everything else will get shifted up accordingly (after a set needs display call).
Preferred Week Start - Default behavior behavior is Monday. Determines what day of the week is in the leftmost column.

How to use Locale and CalendarIdentifier

It's very simple and useful to create calendar base on your locale and of course your country.

NSLocale *persianLocale = [NSLocale alloc]initWithLocaleIdentifier:@"fa-IR"];
[self.calendarView setLocale:persianLocale];

And for using CalendarIdentifier use this property :

[self.calendarView setCalendarIdentifier:NSCalendarIdentifierPersian];

if you set useVeryShortWeekdaySymbols property to YES, use days of week name very short

self.calendarView.useVeryShortWeekdaySymbols = YES;

How to select range of date

English range selection Persian range selection If user Long press on items, can select date and for select end of range, Long press on end date. For get range date use didSelectRangeForStartDate:endDate delegate method like this :

- (void) didSelectRangeForStartDate:(NSDate *)startDate andEndDate:(NSDate *)endDate{ 
    NSLog(@"%s: start date :%@ \n end date : %@",__PRETTY_FUNCTION__,startDate,endDate); 
} 

How to handle changing date event

For this you should use CalendarViewDelegate protocol:

@interface ViewController : UIViewController 
  

@end

 

And setup delegate:

self.calendarView.calendarDelegate = self;

After that you should implement required method didChangeCalendarDate:

- (void)didChangeCalendarDate:(NSDate *)date
{
    NSLog(@"didChangeCalendarDate:%@", date);
}

For more details there're optional methods for other things:

@optional
- (void)didChangeCalendarDate:(NSDate *)date withType:(NSInteger)type withEvent:(NSInteger)event;
- (void)didDoubleTapCalendar:(NSDate *)date withType:(NSInteger)type;

How to customize colors

For customization of colors you can use the following properties:

// Main color of numbers
@property (nonatomic, strong) UIColor *fontColor;
// Color of the headers (Year and month)
@property (nonatomic, strong) UIColor *fontHeaderColor;
// Color of selected numbers
@property (nonatomic, strong) UIColor *fontSelectedColor;
// Color of selection
@property (nonatomic, strong) UIColor *selectionColor;
// Color of today
@property (nonatomic, strong) UIColor *todayColor;

For example:

self.calendarView.selectionColor = [UIColor colorWithRed:0.203 green:0.666 blue:0.862 alpha:1.000];
self.calendarView.fontHeaderColor = [UIColor colorWithRed:0.203 green:0.666 blue:0.862 alpha:1.000];

And you can see the result:
alt tag
It's free for using, feel free. And I hope it will be helpful.

License

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

Comments
  • Calendar Date Issue

    Calendar Date Issue

    There is a problem in which date is written in your library, it shows differently when I scroll and differently when I double tap and go inside the month view

    When I run it after installation and swipe to say November of 2014 then day 1 starts at saturday but if I run it again and then double tap the month to get the list of month and double tap november then day 1 starts on Tuesday.

    I am using a different view controller to show the Calendar and when I press the back button I get this error too

    -[__NSCFCalendar components:fromDate:]: date cannot be nil I mean really, what do you think that operation is supposed to mean with a nil date? An exception has been avoided for now. A few of these errors are going to be reported with this complaint, then further violations will simply silently do whatever random thing results from the nil. Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):

    Can you also add some swipe gesture of left or right motion other than fading effect

    opened by girishnair12345 8
  • Add new feature Date Range

    Add new feature Date Range

    Hi dude I try to test the last version and find out some bug in Persian calendar. I've fix this stuff I was thinking how can i add new feature? so i decided to implement Date Range to select a range of date, you need to use Long Press.

    English range selection Persian range selection

    Thank you Hussein Habibi Juybari

    opened by Husseinhj 6
  • setCurrentDate doesnt work properly

    setCurrentDate doesnt work properly

    When I try to use [self.calendarView setCurrentDate:toDate]; then the start day of the month is not drawn properly. I even tried using [self.calendarView setNeedsDisplay]; but still its not rendering properly. Is there any way I could set a custom date on calendar ?

    opened by girishnair12345 6
  • Add locale and CalendarIdentifier

    Add locale and CalendarIdentifier

    Hi dude I've added locale and CalendarIdentifier for suppor calendar All type of locale for example Persian and etc ... And add some cool stuff you may enjoy

    thanks in advance Hussein Habibi Juybari

    Pictures :

    persian home

    persian popup

    persian popup

    persian popup

    opened by Husseinhj 4
  • Follow-Up to Issue: Extra UI Options

    Follow-Up to Issue: Extra UI Options

    As I noted in the issue, this just primarily adds some more UI options for the component. Specifically, there are now options to

    1. Mark today's date. This can be done in addition to or instead of marking the currently selected date. Default is to only mark the currently selected date.

    2. Collapse the month and year headers. Default is to leave them in place.

    3. Set a preferred starting day of the week. Default is Monday.

    Additionally, there are now exposed methods to move the calendar content forward and backwards (which previously was only possible via swiping).

    There shouldn't be any changes in expected behavior, since it was pretty cool to begin with. There's just some more flexibility for those who want it.

    opened by estansbury 2
  • setCurrentDate

    setCurrentDate

    Hello, Maxim ! I set utc date (it comes from server) and see wrong date in the calendar Why don't you set TimeZone in this method?

    • (void)setCurrentDate:(NSDate *)date

    Thank you

    opened by pvclever 1
  • shouldShowHeaders

    shouldShowHeaders

    Hello, first I want to say that this is a great app! I have only one problem though, when setting the bool for shouldShowHeaders to yes , it put's the headers but shows the days over them. After a swipe it put's them where they should be. Changing the bool to YES from your code solves this problem . Any idea how I could solve this ?

    opened by willeminna 1
  • Supportting Swift?

    Supportting Swift?

    hi, I'm trying to use your calendar. I cloned the repository but couldn't find any swift codes.

    I read older issue with contains screen shot of swift source codes. So I suppose your calendar supports swift.

    Thanks in advance, Satoko

    opened by satoko 1
  • Compatibility with Swift 2

    Compatibility with Swift 2

    Today, Aug 22 of 2016, I installed through CocoaPods this module and got this series of errors, looks like some protocols and functions are deprecated/changed in Swift 2.0 screen shot 2016-08-22 at 10 27 39 am

    opened by keduardo2117 1
  • Become a contributer

    Become a contributer

    Hi!

    So I'm not a very avid Github user but I think I need to become a contributor before I can make a new branch and do any development. Please let me know! I already have some bug fixes and I would love to do a pull request soon.

    Thanks, Vivian

    opened by vrsantos 1
  • fontName not properly set

    fontName not properly set

    Hi!

    I'm using your calendar and I was attempting to change the fontName and it wasn't updating to the font that I wanted. After taking a look at your implementation file, I notice that you use kCalenderViewDefaultFont instead of the fontName property. Do you mind if I make a pull request and fix this change?

    By the way, I also plan on doing some more UI updates in the future if you're okay with that! Things like highlighting the week, etc.

    Thanks! Vivian Santos

    opened by vrsantos 1
  • Doubletap delivering invalid type

    Doubletap delivering invalid type

    This: if (type != CalendarViewTypeDay && type > minType) { --type; [self fade]; }

    Should be at the end of - (void)doubleTap:(UITapGestureRecognizer *)recognizer At the moment, year and month will ATM return the wrong type resulting in the month being the same type as the day.

    opened by Xavjer 1
Releases(0.6)
Owner
Maksym Bilan
Software Engineer
Maksym Bilan
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable

Q: How will my calendar dateCells look with this library? A: However you want them to look. More Images Features Range selection - select dates in a r

PatchTheCode 7.3k Jan 2, 2023
A declarative, performant, iOS calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-featured calendar apps.

HorizonCalendar A declarative, performant, calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-feat

Airbnb 2.2k Jan 4, 2023
Simple customizable calendar component in Swift :calendar:

Koyomi Koyomi is a simple calendar view framework for iOS, written in Swift ?? Content Features Demo App Usage introduction : Change displayed month,

Shohei Yokoyama 741 Dec 24, 2022
Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events

Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events. It will gather events from your default iOS calendar.

Chase 194 Jan 4, 2023
πŸ“† An elegant calendar control for iOS.

NO LONGER MAINTAINED Daysquare An elegant calendar control for iOS. Introduction Get bored with native silly UIDatePicker? You may have a try on this

Cyandev 701 Sep 9, 2022
A calendar control for iOS written in swift with mvvm pattern

ASCalendar try it on appetize Installation CocoaPods You can use CocoaPods to install ASCalendar by adding it to your Podfile: platform :ios, '8.0' us

Alberto Scampini 192 Jun 26, 2022
A SwiftUI calendar view that allows month switching and date picking.

Selectable Calendar View A SwiftUI calendar view that allows month switching and date picking. Usage You can simply add this repository to your projec

γ‚·γƒ₯ンジョーゑ 10 Jul 21, 2022
A calendar quick view for the MacOS status bar

Calendar Quick View Quick Menu Calendar in the mac app store An open source macOS calendar preview utility Download from the Mac App Store Visualizati

Michaellis 18 Oct 26, 2022
A fully customizable calendar view acting as a date range picker

Demo Installation CocoaPods With CocoaPods you can simply add GLCalendarView in your Podfile: pod "GLCalendarView", "~> 1.0.0" Source File You can co

Glow Inc 860 Nov 18, 2022
A customizable calendar view for iOS.

JTCalendar JTCalendar is an easily customizable calendar control for iOS. Installation With CocoaPods, add this line to your Podfile. pod 'JTCalendar'

Jonathan Vukovich-Tribouharet 2.8k Dec 27, 2022
SwiftUI Simple Calendar / Date Picker for iOS

RKCalendar RKCalendar is a SwiftUI Calendar / Date Picker for iOS. Features include: minimum and maximum calendar dates selectable, single date select

null 453 Dec 28, 2022
SwiftUICalendar - SwiftUI simple calendar

SwiftUICalendar Installation CocoaPods pod 'SwiftUICalendar' import import SwiftUICalendar Features Infinite scroll Support horizontal and vertical sc

null 59 Dec 27, 2022
Dead simple calendar implementation

Package provides a CalendarView which can be used to display simple calendar in your App.

Sergei Kononov 4 Oct 7, 2022
πŸ“… Calendar for iOS, iPadOS and macOS in Swift

CalendarKit CalendarKit is a Swift calendar UI library for iOS, iPadOS and Mac Catalyst. It looks similar to the Apple Calendar app out-of-the-box, wh

Richard Topchii 2.2k Jan 5, 2023
An open source calendar framework for iOS, with support for customization, IBDesignable, Autolayout, and more.

About MBCalendarKit is a calendar control written in Objective-C with modern best practices and Swift interoperability in mind. It offers a flexible c

Moshe 563 Oct 27, 2022
A fully customizable iOS calendar library, compatible with Objective-C and Swift

Table of contents Screenshots Installation Pre-knowledge Support Contact Screenshots iPhone iPad Safe Orientation Today Extension iOS8/9 iOS10 Interac

Wenchao Ding 10.2k Jan 2, 2023
CalendarApp Swift - Made a calendar app in swift, completely from scratch using UIStackView and UICollectionView

CalendarApp_Swift Made a calendar app in swift, completely from scratch using UI

Arnav Chhokra 1 Feb 4, 2022
A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.

A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.

jasu 45 Dec 20, 2022
An iOS pre-permissions utility that lets developers ask users on their own dialog for calendar, contacts, location, photos, reminders, twitter, push notifications and more, before making the system-based permission request.

An iOS pre-permissions utility that lets developers ask users on their own dialog for calendar, contacts, location, photos, reminders, twitter, push notifications and more, before making the system-based permission request.

Joe L 420 Dec 22, 2022