/RRULE-to-EKRecurrenceRule

Transform a RRULE string representation (RFC 2445) into a EKRecurrenceRule.

Primary LanguageObjective-CApache License 2.0Apache-2.0

RRULE-to-EKRecurrenceRule

RRULE-to-EKRecurrenceRule is the easiest way to transform a RRULE string representation (RFC 2445) into an EKRecurrenceRule. 'EKRecurrenceRule+RRULE' is an Objective-C category which adds a new initializer to the EKRecurrenceRule class. EKRecurrenceRule is available in iOS 4.0 and later and needs the EventKit framework.

Getting Started

  • Download RRULE-to-EKRecurrenceRule and play with the included Xcode project.
  • Copy 'EKRecurrenceRule+RRULE.h' and 'EKRecurrenceRule+RRULE.m' into your own Xcode project.
  • Add #import "EKRecurrenceRule+RRULE.h" to all files you would like to use RRULE-to-EKRecurrenceRule.

Example

#import "EKRecurrenceRule+RRULE.h"

- (void)testMethod
{
    // Test
    NSString *rfc2445String = @"FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2"; // The 2nd to last weekday of the month

    // Result
    EKRecurrenceRule *recurrenceRule = [[EKRecurrenceRule alloc] initWithString:rfc2445String];
    NSLog(@"%@", recurrenceRule);
}

Notes

  • EKRecurrenceRule does add WKST=SU automatically
  • EKRecurrenceRule does only support DAILY, WEEKLY, MONTHLY, YEARLY frequencies

ARC

RRULE-to-EKRecurrenceRule uses ARC.

If you are including the RRULE-to-EKRecurrenceRule sources directly into a project that does not yet use Automatic Reference Counting, you will need to set the -fobjc-arc compiler flag on all of the RRULE-to-EKRecurrenceRule source files. To do this in Xcode, go to your active target and select the "Build Phases" tab. Now select all RRULE-to-EKRecurrenceRule source files, press Enter, insert -fobjc-arc and then "Done" to enable ARC for RRULE-to-EKRecurrenceRule.

License

RRULE-to-EKRecurrenceRule is licensed under the terms of the Apache License, version 2.0. Please see the LICENSE file for full details.

Credits

RRULE-to-EKRecurrenceRule is brought to you by Jochen Schöllig and the Codeatelier team.