iOS 7+ Calendar (Date Picker) with Infinite Scrolling.

Overview

RSDayFlow Build Status Carthage compatible

Sample

iOS 7 Calendar with Infinite Scrolling. Only need 4 lines of code to set up.

RSDayFlow is a slim fork of DayFlow with updates and extensions:

  • Visual feedback of the currently selected cell
  • Possibility to mark the date
  • Design like iOS 7
  • Much more updates

Installation

CocoaPods is the recommended method of installing RSDayFlow. Simply add the following line to your Podfile:

Podfile

pod 'RSDayFlow'

Basic Usage

Import the class header.

#import "RSDFDatePickerView.h"

Just create your date picker view and set a delegate / a data source if needed.

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    RSDFDatePickerView *datePickerView = [[RSDFDatePickerView alloc] initWithFrame:self.view.bounds];
    datePickerView.delegate = self;
    datePickerView.dataSource = self;
    [self.view addSubview:datePickerView];
}

Delegate (optional)

RSDFDatePickerView provides three delegate methods. The method datePickerView:shouldHighlightDate: asks the delegate if the date should be highlighted during tracking. The method datePickerView:shouldSelectDate: asks the delegate if the specified date should be selected. The method datePickerView:didSelectDate: called when a user click on a specific date. To use them, implement the delegate in your view controller.

@interface ViewController () <RSDFDatePickerViewDelegate>

Then implement the delegate functions.

// Returns YES if the date should be highlighted or NO if it should not.
- (BOOL)datePickerView:(RSDFDatePickerView *)view shouldHighlightDate:(NSDate *)date
{
    return YES;
}

// Returns YES if the date should be selected or NO if it should not.
- (BOOL)datePickerView:(RSDFDatePickerView *)view shouldSelectDate:(NSDate *)date
{
    return YES;
}

// Prints out the selected date.
- (void)datePickerView:(RSDFDatePickerView *)view didSelectDate:(NSDate *)date
{
    NSLog(@"%@", [date description]);
}

DataSource (optional)

RSDFDatePickerView provides three data source methods. The method datePickerView:shouldMarkDate: asks the data source if the date should be marked. The method datePickerView:markImageColorForDate: asks the data source about the color of the default mark image for the specified date. The method datePickerView:markImageForDate: asks the data source about the mark image for the specified date. The method datePickerView:markImageColorForDate: will be ignored if the method datePickerView:markImageForDate: is implemented. To use these methods, implement the data source in your view controller.

@interface ViewController () <RSDFDatePickerViewDataSource>

Then implement the data source functions.

// Returns YES if the date should be marked or NO if it should not.
- (BOOL)datePickerView:(RSDFDatePickerView *)view shouldMarkDate:(NSDate *)date
{
    // The date is an `NSDate` object without time components.
    // So, we need to use dates without time components.
    
    NSCalendar *calendar = [NSCalendar currentCalendar];
    unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |  NSDayCalendarUnit;
    NSDateComponents *todayComponents = [calendar components:unitFlags fromDate:[NSDate date]];
    NSDate *today = [calendar dateFromComponents:todayComponents];
    
    return [date isEqual:today];
}

// Returns the color of the default mark image for the specified date.
- (UIColor *)datePickerView:(RSDFDatePickerView *)view markImageColorForDate:(NSDate *)date
{
    if (arc4random() % 2 == 0) {
        return [UIColor grayColor];
    } else {
        return [UIColor greenColor];
    }
}

// Returns the mark image for the specified date.
- (UIImage *)datePickerView:(RSDFDatePickerView *)view markImageForDate:(NSDate *)date
{
    if (arc4random() % 2 == 0) {
        return [UIImage imageNamed:@"img_gray_mark"];
    } else {
        return [UIImage imageNamed:@"img_green_mark"];
    }
}

Customization

Every view is customizable to fit your need. Create a subclass of the desired view and override the default values.

Coming Soon

  • If you would like to request a new feature, feel free to raise as an issue.

Demo

Build and run the RSDayFlowExample project in Xcode to see RSDayFlow in action. Have fun. Make it faster. Fork and send pull requests. Figure out hooks for customization.

Contact

Ruslan Skorb

License

This project is is available under the MIT license. See the LICENSE file for more info. Attribution by linking to the project page is appreciated.

Comments
  • Fix for #48, allow limiting dates in the calendar

    Fix for #48, allow limiting dates in the calendar

    Thanks for the awesome component. This PR allows setting a start or end range, I'm also working on support for date range selection, will open another PR soon

    enhancement 
    opened by aryaxt 18
  • 'NSCalendarIdentifierGregorian' is unavailable: not available on iOS

    'NSCalendarIdentifierGregorian' is unavailable: not available on iOS

    using the same code as described in README.md, I see following error in my code

    Error:Build failed with 2 errors and 0 warnings in 1 sec
    /Users/harith/code/XcodeProjects/pennyapp-ios/Pods/RSDayFlow/RSDayFlow/RSDFDatePickerView.m
    Error:(125, 68) 'NSCalendarIdentifierGregorian' is unavailable: not available on iOS
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCalendar.h
    Included from:
    (26)   /Users/harith/code/XcodeProjects/pennyapp-ios/Pods/RSDayFlow/RSDayFlow/NSCalendar+RSDFAdditions.h
    Note:(39, 36) declaration has been explicitly marked unavailable here
    Included from:
    (26)   /Users/harith/code/XcodeProjects/pennyapp-ios/Pods/RSDayFlow/RSDayFlow/NSCalendar+RSDFAdditions.h
    Note:(39, 36) declaration has been explicitly marked unavailable here
    /Users/harith/code/XcodeProjects/pennyapp-ios/Pods/RSDayFlow/RSDayFlow/RSDFDatePickerDaysOfWeekView.m
    Error:(84, 68) 'NSCalendarIdentifierGregorian' is unavailable: not available on iOS
    
    opened by hhimanshu 18
  • Add multiple Events Same day and display multiple dots

    Add multiple Events Same day and display multiple dots

    sample Your are doing a great job ,I need to know that Is there any provision to show multiple events by displaying more than one dots below the date and display events below when clicked on that particular date as in the image. Thanks, Rix

    opened by Rix1212 14
  • scrollToDate: method crashes

    scrollToDate: method crashes

    When specifying a date parameter of March 1, 2015 or later, Xcode crashes with an error stating "attempt to scroll to invalid index path: <NSIndexPath: 0xc000000000000316> {length = 2, path = 12 - 0}"

    opened by jhaybie 13
  • Issue With Daylight Savings

    Issue With Daylight Savings

    Hi I seem to be having an issue with daylight savings. Where when selecting a date on the date picker view the date returned from

    -(void)dateSelectionViewController:(RSDFDatePickerView *)view didSelectDate:(NSDate *)date
    

    Is correct for dates up to the 29th of march i.e logging the NSDate returns for 29th of March returns 2015-03-29 00:00:00 +0000

    While logging dates after (example the 30th of march) that returns 2015-03-29 23:00:00 +0000.

    Was wondering did anyone have a similar problem?

    Thanks.

    opened by ConorLinehan 10
  • Limit calendar start and end dates

    Limit calendar start and end dates

    Is there any convenient way to set the start and the end of the calendar view with, say months from today?

    E.g. I want my calendar to show only 3 previous months and 6 future months. Is it possible in the current setup?

    enhancement 
    opened by ShadeApps 10
  • Added ability to select a date range

    Added ability to select a date range

    Note: because the delegate method for date range can have a null second date, I had to add nullability to the delegate method in order support Swift, and that required adding nullability to all methods and properties in the header file

    Still doing some cleanup, will post a comment when it's ready

    enhancement 
    opened by aryaxt 9
  • Insert personal data

    Insert personal data

    Hi,i need to change NSDate * today with one date i want chose ( this date have format "dd-MM-yyy"). Because when i try to insert my date the green circle marker doesn't appear. How can a do that?

    opened by SwiftySrl 9
  • Swift3/Xcode 8 support

    Swift3/Xcode 8 support

    Hi Im using Xcode8 and cocoapods in a swift 3 project and RSDayFlow is not able to compile. The component looks really great and i hope there will be a fix to this, or maybe even a swift 3 version. Thanks for you hardwork on this awesome component so far :)

    Best Regards Morten

    duplicate 
    opened by MortenHN81 8
  • Use trait collection to decide which form of weekday symbols should be used

    Use trait collection to decide which form of weekday symbols should be used

    Currently RSDayFlow uses isPhone and isPortraitInterfaceOrientation to decide the form of weekday symbols. It mostly fine, but has problems when the view is in split view.

    screen shot 2015-06-15 at 11 03 04 am

    The best way is to use trait collection. However it requires iOS 8. Another workaround is to use the width of the view. Thoughts?

    opened by xhacker 8
  • Half Screen Calendar with Horizontal Scroll

    Half Screen Calendar with Horizontal Scroll

    Currently we can only have a full screen calendar view that allows vertical scrolling. I am looking forward to a calendar control that is not covering the full screen and allows horizontal scrolling. What parameters are to be tuned in order to achieve this? Do we have a support for this?

    enhancement 
    opened by ghost 8
Releases(1.8.0)
Owner
Ruslan Skorb
"The best way to predict the future is to create it" – Abraham Lincoln. Let's create our future together! Founder & Principal Software Engineer @ R.SK Lab
Ruslan Skorb
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
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
An easy to use SwiftUI date picker for Shamsi (Persian) calendar

ShamsiDatePicker An easy-to-use SwiftUI iOS/watchOS date picker for Shamsi (Persian) calendar. Features Pure (100%) SwiftUI implementation Full suppor

Seyyed Parsa Neshaei 20 Nov 24, 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
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
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 Swift UI component for Lunar Calendar Picker

LunarYearDatePicker a Swift UI component for Lunar Calendar Picker Usage: struct

null 6 Nov 22, 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 Easy to Use Calendar for iOS (Swift 5.0)

This is an easy to use, "just drag and drop it in your code" type of calendar for iOS. It supports both vertical and horizontal scrolling, as well as

Michael Michailidis 525 Dec 23, 2022
A custom visual calendar for iOS 8+ written in Swift (>= 4.0).

Overview Screenshots GIF Demo Installation Usage Architecture Version matrix Advanced API For contributors Screenshots GIF Demo Installation CocoaPods

null 3.5k Dec 24, 2022
An availability calendar implementation for iOS

NWCalendarView NWCalendar View is an iOS control that displays a calendar. It is perfect for appointment or availibilty selection. It allows for selec

Nicholas Wargnier 60 May 27, 2021
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
📆 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
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
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