Skip to content

marsepu/iCal4ObjC

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

---+!! iCal4ObjC

%TOC%

---++ Introduction

iCal4ObjC is a Objective-C implementation of the iCalendar specification as defined in [[http://tools.ietf.org/html/rfc2445][RFC2455]] for iOS and !MacOSX platforms such as iPhone and iPad. It supports to read or write the components of iCalendar in the stream easily. For more the information, please check [[http://www.cybergarage.org/doxygen/ical4objc/][the doxygen documentation]].

---++ Installation

---+++ Getting SDK Package

1. Get the SDK package from the following site.

| *GitHub* | https://github.com/cybergarage/iCal4ObjC |

2. Adding iCalObjCSDK to your project

To use iCalForObj4 on your XCode project, you have to add the following files in [[https://github.com/cybergarage/iCal4ObjC/tree/master/iCalObjCSDK][iCalObjCSDK]] subfolder of the SDK package. 

<verbatim>
CGICalendar.h
CGICalendar.m
CGICalendarComponent.h
CGICalendarComponent.m
CGICalendarContentLine.h
CGICalendarContentLine.m
CGICalendarObject.h
CGICalendarObject.m
CGICalendarParameter.h
CGICalendarParameter.m
CGICalendarProperty.h
CGICalendarProperty.m
CGICalendarValue.h
CGICalendarValue.m
NSDate+CGICalendar.h
NSDate+CGICalendar.m
</verbatim>

---++ Usage

---+++ Parsing iCalendar objects

To parse an existing iCalendar stream or string use !CGICalendar::parse as the following.

<verbatim>
#import "CGICalendar.h"

CGICalendar *ical = [[CGICalendar alloc] init];
if ([ical parseWithPath:icalPath error:nil]) {
    ..........
}
</verbatim>

To traverse the all objects, components, properties and parameters in a iCalendar, use !CGICalendar::objects, !CGICalendarObject::components, !CGICalendarComponent::properties and !CGICalendarProperty:: parameters as the following.

<verbatim>
for (CGICalendarObject *icalObj in [self objects]) {
    for (CGICalendarComponent *icalComp in [icalObj components]) {
        NSString *icalCompType = [icalComp type];
        ..........
        for (CGICalendarProperty *icalProp in [icalComp properties]) {
            NSString *icalPropName = [icalProp name];
            NSString *icalPropValue = [icalProp value];
            ..........
            for (CGICalendarParameter *icalParam in [icalProp parameters]) {
                NSString *icalParamName = [icalProp name];
                NSString *icalPropValue = [icalProp value];
                ..........
            }
        }
    }
}
</verbatim>

---+++ Adding objects, components or properties

To add your objects, components and properties into a iCalendar instance, use !CGICalendar::addObject:, !CGICalendarObject::addComponent: and !CGICalendarComponent::addProperty: as the following.

<verbatim>
CGICalendar *ical = [[CGICalendar alloc] init];

// Add a object
CGICalendarObject *icalObj = [[[CGICalendarObject alloc] initWithProdid:@"//CyberGarage//iCal4ObjC//EN"] autorelease];
[ical addObject:icalObj];

// Add a component
CGICalendarComponent *icalComp = [[[CGICalendarComponent alloc] initWithType:@"VTODO"] autorelease];
[icalObj addComponent:icalComp];

// Add a property
CGICalendarProperty *icalProp = [[[CGICalendarProperty alloc] init] autorelease];
[icalProp setName:@"SUMMARY"];
[icalProp setValue:@"Write report"];
[icalComp addComponent:icalProp];
</verbatim>

---+++ Writing iCalendar objects

To export a iCalendar object into a file, use !CGICalendar:writeToFile as the following.

<verbatim>
CGICalendar *ical = ..........
.........
[ical writeToFile:@"MyToDo.ics"];
</verbatim>

---++ Resources

---+++ Repositories

Please see [[https://github.com/cybergarage/XPathQuery4ObjC the project page]] on !GitHub to get the source codes with the examples :-)

| *GitHub* | https://github.com/cybergarage/iCal4ObjC | 
| *Doxygen* | http://www.cybergarage.org/doxygen/ical4objc/ | 

About

iCal4ObjC is a simple Objective-C framework for iCalendar specification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%