-
Notifications
You must be signed in to change notification settings - Fork 21
/
README
119 lines (87 loc) · 3.72 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---+!! 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]].
---++ Recent Updates
v 1.1.0 - ARC Support, CocoaPod specification
---++ 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/ |