-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventKit.framework.h
More file actions
2092 lines (1767 loc) · 95.1 KB
/
EventKit.framework.h
File metadata and controls
2092 lines (1767 loc) · 95.1 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ========== EventKit.framework/Headers/EKCalendar.h
//
// EKCalendar.h
// EventKit
//
// Copyright 2009-2010 Apple Inc. All rights reserved.
//
#import <EventKit/EventKitDefines.h>
#import <EventKit/EKObject.h>
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <EventKit/EKTypes.h>
NS_ASSUME_NONNULL_BEGIN
@class EKEventStore, EKSource;
#if TARGET_OS_OSX
@class NSColor;
#endif
/*!
@class EKCalendar
@abstract The EKCalendar class represents a calendar for events.
*/
NS_CLASS_AVAILABLE(10_8, 4_0)
@interface EKCalendar : EKObject
// Create a new calendar in the specified event store. You should use calendarForEntityType in iOS 6 or later.
+ (EKCalendar*)calendarWithEventStore:(EKEventStore *)eventStore NS_DEPRECATED(NA, NA, 4_0, 6_0);
/*!
@method calendarForEntityType:
@abstract Creates a new autoreleased calendar that may contain the given entity type.
@discussion You can only create calendars that accept either reminders or events via our API.
However, other servers might allow mixing the two (though it is not common).
@param entityType The entity type that this calendar may support.
@param eventStore The event store in which to create this calendar.
*/
+ (EKCalendar *)calendarForEntityType:(EKEntityType)entityType eventStore:(EKEventStore *)eventStore NS_AVAILABLE(10_8, 6_0);
/*!
@property source
@abstract The source representing the 'account' this calendar belongs to.
This is only settable when initially creating a calendar and then
effectively read-only after that. That is, you can create a calendar,
but you cannot move it to another source.
@discussion This will be nil for new calendars until you set it.
*/
@property(null_unspecified, nonatomic, strong) EKSource *source;
/*!
@property calendarIdentifier
@abstract A unique identifier for the calendar. It is not sync-proof in that a full
sync will lose this identifier, so you should always have a back up plan for dealing
with a calendar that is no longer fetchable by this property, e.g. by title, type, color, etc.
Use [EKEventStore calendarWithIdentifier:] to look up the calendar by this value.
*/
@property(nonatomic, readonly) NSString *calendarIdentifier NS_AVAILABLE(10_8, 5_0);
/*!
@property title
@abstract The title of the calendar.
*/
@property(nonatomic, copy) NSString *title;
/*!
@property type
@abstract The type of the calendar as a EKCalendarType. This is actually based on
what source the calendar is in, as well as whether it is a subscribed calendar.
@discussion CalDAV subscribed calendars have type EKCalendarTypeCalDAV with isSubscribed = YES.
*/
@property(nonatomic, readonly) EKCalendarType type;
/*!
@property allowsContentModifications
@abstract Represents whether you can this add, remove, or modify items in this calendar.
*/
@property(nonatomic, readonly) BOOL allowsContentModifications;
/*!
@property subscribed
@abstract YES if this calendar is a subscribed calendar.
*/
@property(nonatomic, readonly, getter=isSubscribed) BOOL subscribed NS_AVAILABLE(10_8, 5_0);
/*!
@property immutable
@abstract If this is set to YES, it means you cannot modify any attributes of
the calendar or delete it. It does NOT imply that you cannot add events
or reminders to the calendar.
*/
@property(nonatomic, readonly, getter=isImmutable) BOOL immutable NS_AVAILABLE(10_8, 5_0);
/*!
@property color
@abstract Returns the calendar color as a CGColorRef.
@discussion This will be nil for new calendars until you set it.
*/
@property(null_unspecified, nonatomic) CGColorRef CGColor API_AVAILABLE(ios(4.0), macos(10.15), watchos(2.0));
#if TARGET_OS_OSX
/*!
@property color
@abstract Returns the calendar color as a NSColor.
@discussion This will be nil for new calendars until you set it.
*/
@property(null_unspecified, nonatomic, copy) NSColor *color API_AVAILABLE(macos(10.8));
#endif
/*!
@property supportedEventAvailabilities
@discussion Returns a bitfield of supported event availabilities, or EKCalendarEventAvailabilityNone
if this calendar does not support setting availability on an event.
*/
@property(nonatomic, readonly) EKCalendarEventAvailabilityMask supportedEventAvailabilities;
/*
@property allowedEntityTypes
@discussion Returns the entity types this calendar can contain. While our API only allows creation
of single-entity calendars, other servers might allow mixed-entity calendars.
*/
@property(nonatomic, readonly) EKEntityMask allowedEntityTypes NS_AVAILABLE(10_8, 6_0);
@end
NS_ASSUME_NONNULL_END
// ========== EventKit.framework/Headers/EKStructuredLocation.h
//
// EKStructuredLocation.h
// EventKit
//
// Copyright 2011 Apple Inc. All rights reserved.
//
#import <EventKit/EventKitDefines.h>
#import <EventKit/EKObject.h>
#import <CoreLocation/CLLocation.h>
NS_ASSUME_NONNULL_BEGIN
@class MKMapItem;
NS_CLASS_AVAILABLE(10_8, 6_0)
@interface EKStructuredLocation : EKObject <NSCopying>
+ (instancetype)locationWithTitle:(NSString *)title;
+ (instancetype)locationWithMapItem:(MKMapItem *)mapItem NS_AVAILABLE(10_11, 9_0);
@property(nullable, nonatomic, strong) NSString *title;
@property(nonatomic, strong, nullable) CLLocation *geoLocation;
@property(nonatomic) double radius; // 0 = use default, unit is meters
@end
NS_ASSUME_NONNULL_END
// ========== EventKit.framework/Headers/EventKit.h
/*
* EventKit.h
* EventKit
*
* Copyright 2010 Apple Inc. All rights reserved.
*
*/
#import <TargetConditionals.h>
#import <Availability.h>
#if __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED || !TARGET_OS_IPHONE
#import <EventKit/EventKitDefines.h>
#import <EventKit/EKTypes.h>
#import <EventKit/EKAlarm.h>
#import <EventKit/EKEventStore.h>
#import <EventKit/EKCalendar.h>
#import <EventKit/EKError.h>
#import <EventKit/EKEvent.h>
#import <EventKit/EKParticipant.h>
#import <EventKit/EKRecurrenceRule.h>
#import <EventKit/EKReminder.h>
#import <EventKit/EKSource.h>
#import <EventKit/EKStructuredLocation.h>
#endif //#if __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
// ========== EventKit.framework/Headers/EKRecurrenceDayOfWeek.h
//
// EKRecurrenceDayOfWeek.h
// EventKit
//
// Copyright 2010 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <EventKit/EventKitDefines.h>
#import <EventKit/EKTypes.h>
NS_ASSUME_NONNULL_BEGIN
/*!
@class EKRecurrenceDayOfWeek
@abstract Class which represents a day of the week this recurrence will occur.
@discussion EKRecurrenceDayOfWeek specifies either a simple day of the week, or the nth instance
of a particular day of the week, such as the third Tuesday of every month. The week
number is only valid when used with monthly or yearly recurrences, since it would
be otherwise meaningless.
Valid values for dayOfTheWeek are integers 1-7, which correspond to days of the week
with Sunday = 1. Valid values for weekNumber portion are (+/-)1-53, where a negative
value indicates a value from the end of the range. For example, in a yearly event -1
means last week of the year. -1 in a Monthly recurrence indicates the last week of
the month.
The value 0 also indicates the weekNumber is irrelevant (every Sunday, etc.).
Day-of-week weekNumber values that are out of bounds for the recurrence type will
result in an exception when trying to initialize the recurrence. In particular,
weekNumber must be zero when passing EKRecurrenceDayOfWeek objects to initialize a weekly
recurrence.
*/
NS_CLASS_AVAILABLE(10_8, 4_0)
@interface EKRecurrenceDayOfWeek : NSObject <NSCopying, NSSecureCoding> {
}
/*!
@method dayOfWeek:
@abstract Creates an autoreleased object with a day of the week and week number of zero.
*/
+ (instancetype)dayOfWeek:(EKWeekday)dayOfTheWeek;
/*!
@method dayOfWeek:weekNumber:
@abstract Creates an autoreleased object with a specific day of week and week number.
*/
+ (instancetype)dayOfWeek:(EKWeekday)dayOfTheWeek weekNumber:(NSInteger)weekNumber;
/*!
@method initWithDayOfTheWeek:weekNumber:
@abstract Creates an day-of-week object with a specific day of week and week number.
*/
- (id)initWithDayOfTheWeek:(EKWeekday)dayOfTheWeek weekNumber:(NSInteger)weekNumber;
/*!
@property dayOfTheWeek
@abstract The day of the week.
*/
@property(nonatomic, readonly) EKWeekday dayOfTheWeek;
/*!
@property weekNumber
@abstract The week number.
*/
@property(nonatomic, readonly) NSInteger weekNumber;
@end
NS_ASSUME_NONNULL_END
// ========== EventKit.framework/Headers/EKRecurrenceEnd.h
//
// EKRecurrenceEnd.h
// EventKit
//
// Copyright 2010 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <EventKit/EventKitDefines.h>
NS_ASSUME_NONNULL_BEGIN
/*!
@class EKRecurrenceEnd
@abstract Class which represents when a recurrence should end.
@discussion EKRecurrenceEnd is an attribute of EKRecurrenceRule that defines how long
the recurrence is scheduled to repeat. The recurrence can be defined either
with an NSUInteger that indicates the total number times it repeats, or with
an NSDate, after which it no longer repeats. An event which is set to never
end should have its EKRecurrenceEnd set to nil.
If the end of the pattern is defines with an NSDate, the client must pass a
valid NSDate, nil cannot be passed. If the end of the pattern is defined as
terms of a number of occurrences, the occurrenceCount passed to the initializer
must be positive, it cannot be 0. If the client attempts to initialize a
EKRecurrenceEnd with a nil NSDate or OccurrenceCount of 0, an exception is raised.
A EKRecurrenceEnd initialized with an end date will return 0 for occurrenceCount.
One initialized with a number of occurrences will return nil for its endDate.
*/
NS_CLASS_AVAILABLE(10_8, 4_0)
@interface EKRecurrenceEnd : NSObject <NSCopying, NSSecureCoding> {
}
/*!
@method recurrenceEndWithEndDate:
@abstract Creates an autoreleased recurrence end with a specific end date.
*/
+ (instancetype)recurrenceEndWithEndDate:(NSDate *)endDate;
/*!
@method recurrenceEndWithOccurrenceCount:
@abstract Creates an autoreleased recurrence end with a maximum occurrence count.
*/
+ (instancetype)recurrenceEndWithOccurrenceCount:(NSUInteger)occurrenceCount;
/*!
@property endDate
@abstract The end date of this recurrence, or nil if it's count-based.
*/
@property(nonatomic, readonly, nullable) NSDate *endDate;
/*!
@property occurrenceCount
@abstract The maximum occurrence count, or 0 if it's date-based.
*/
@property(nonatomic, readonly) NSUInteger occurrenceCount;
@end
NS_ASSUME_NONNULL_END
// ========== EventKit.framework/Headers/EKEventStore.h
//
// EKEventStore.h
// EventKit
//
// Copyright 2009-2010 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <EventKit/EventKitDefines.h>
#import <EventKit/EKTypes.h>
NS_ASSUME_NONNULL_BEGIN
@class EKCalendar, EKEvent, EKSource, EKReminder, EKCalendarItem;
/*!
@enum EKSpan
@abstract Values for controlling what occurrences to affect in a recurring event.
@discussion This enumerated type is used to indicate the scope of a change being made to a repeating event. EKSpanThisEvent
indicates the changes should apply only to this event, EKSpanFutureEvents indicates the changes should apply to
this event and all future events in the pattern.
@constant EKSpanThisEvent Affect this event only.
@constant EKSpanFutureEvents Affect this event and all after it.
*/
typedef NS_ENUM(NSInteger, EKSpan) {
EKSpanThisEvent,
EKSpanFutureEvents
};
typedef void (^EKEventSearchCallback)(EKEvent *event, BOOL *stop);
/*!
@class EKEventStore
@abstract The EKEventStore class provides an interface for accessing and manipulating calendar events and reminders.
@discussion The EKEventStore class is the main point of contact for accessing Calendar data. You must
create a EKEventStore object in order to retrieve/add/delete events or reminders from the Calendar database.
Events, Reminders, and Calendar objects retrieved from an event store cannot be used with any other event
store. It is generally best to hold onto a long-lived instance of an event store, most
likely as a singleton instance in your application.
*/
NS_CLASS_AVAILABLE(10_8, 4_0)
@interface EKEventStore : NSObject
/*!
@method authorizationStatusForEntityType:
@discussion Returns the authorization status for the given entity type
*/
+ (EKAuthorizationStatus)authorizationStatusForEntityType:(EKEntityType)entityType NS_AVAILABLE(10_9, 6_0);
/*!
@method initWithAccessToEntityTypes:
@discussion Users are able to grant or deny access to event and reminder data on a per-app basis. To request access to
event and/or reminder data, instantiate an EKEventStore using this method. This call will not block the
program while the user is being asked to grant or deny access. Until access has been granted for an entity
type, this event store will not contain any calendars for that entity type, and any attempt to save entities
of that entity type will fail. If access is later granted or declined, the event store will broadcast an
EKEventStoreChangedNotification. You can check the current access status for an entity type
using +authorizationStatusForEntityType:. The user will only be prompted the first time access is requested; any
subsequent instantiations of EKEventStore will use the existing permissions.
@param entityTypes A bit mask of entity types to which you want access
*/
- (id)initWithAccessToEntityTypes:(EKEntityMask)entityTypes NS_DEPRECATED(10_8, 10_9, NA, NA);
/*!
@method init
*/
- (id)init NS_AVAILABLE(10_9, 4_0);
/*!
@method initWithSources:
@abstract Creates a new event store that only includes items and calendars for a subset of sources.
@param sources The sources you want this event store to recognize. This may include delegate sources.
*/
- (instancetype)initWithSources:(NSArray<EKSource *> *)sources NS_AVAILABLE(10_11, NA);
typedef void(^EKEventStoreRequestAccessCompletionHandler)(BOOL granted, NSError * __nullable error);
/*!
@method requestAccessToEntityType:completion:
@discussion Users are able to grant or deny access to event and reminder data on a per-app basis. To request access to
event and/or reminder data, call -requestAccessToEntityType:completion:. This will not block the app while
the user is being asked to grant or deny access.
Until access has been granted for an entity type, the event store will not contain any calendars for that
entity type, and any attempt to save will fail. The user will only be prompted the first time access is
requested; any subsequent instantiations of EKEventStore will use the existing permissions. When the user
taps to grant or deny access, the completion handler will be called on an arbitrary queue.
*/
- (void)requestAccessToEntityType:(EKEntityType)entityType completion:(EKEventStoreRequestAccessCompletionHandler)completion NS_AVAILABLE(10_9, 6_0);
/*!
@property eventStoreIdentifier
@abstract Returns a unique identifier string representing this calendar store.
*/
@property(nonatomic, readonly) NSString *eventStoreIdentifier;
//----------------------------------------------------
// SOURCES
//----------------------------------------------------
/*!
@property delegateSources
@abstract Returns an unordered array of sources for all available delegates.
@discussion By default, delegates are not included in an event store's sources. To work with delegates,
you can create a new event store and pass in the sources, including sources returned from this
method, that you're interested in.
@see initWithSources:
*/
@property (nonatomic, readonly) NSArray<EKSource *> *delegateSources NS_AVAILABLE(10_11, 12_0);
/*!
@property sources
@abstract Returns an unordered array of sources.
*/
@property (nonatomic, readonly) NSArray<EKSource *> *sources NS_AVAILABLE(10_8, 5_0);
/*!
@method sourceWithIdentifier:
@abstract Returns a source with a specified identifier.
*/
- (nullable EKSource *)sourceWithIdentifier:(NSString *)identifier NS_AVAILABLE(10_8, 5_0);
//----------------------------------------------------
// CALENDARS
//----------------------------------------------------
/*!
@method calendars
@abstract While this returns an array, the calendars are unordered. This call is deprecated
and only returns calendars that support events. If you want reminder calendars
you should use calendarsForEntityType:
*/
@property(nonatomic, readonly) NSArray<EKCalendar *> *calendars NS_DEPRECATED(NA, NA, 4_0, 6_0);
/*!
@method calendarsForEntityType
@abstract Returns calendars that support a given entity type (reminders, events)
*/
- (NSArray<EKCalendar *> *)calendarsForEntityType:(EKEntityType)entityType NS_AVAILABLE(10_8, 6_0);
/*!
@property defaultCalendarForNewEvents
@abstract Returns the calendar that events should be added to by default.
@discussion This may be nil if there is no default calendar for new events.
*/
@property(nullable, nonatomic, readonly) EKCalendar *defaultCalendarForNewEvents;
/*!
@method defaultCalendarForNewReminders
@abstract Returns the calendar that reminders should be added to by default.
@discussion This may be nil if there is no default calendar for new reminders.
*/
- (nullable EKCalendar *)defaultCalendarForNewReminders NS_AVAILABLE(10_8, 6_0);
/*!
@method calendarWithIdentifier:
@abstract Returns a calendar with a specified identifier.
*/
- (nullable EKCalendar *)calendarWithIdentifier:(NSString *)identifier NS_AVAILABLE(10_8, 5_0);
/*!
@method saveCalendar:commit:error:
@abstract Saves changes to a calendar, or adds a new calendar to the database.
@discussion This method attempts to save the given calendar to the calendar database. It
returns YES if successful and NO otherwise. Passing a calendar fetched from
another EKEventStore instance into this function will raise an exception.
On WatchOS, saving changes is not supported.
@param calendar The calendar to save.
@param commit Pass YES to cause the database to save. You can pass NO to save multiple
calendars and then call commit: to save them all at once.
@param error If an error occurs, this will contain a valid NSError object on exit.
*/
- (BOOL)saveCalendar:(EKCalendar *)calendar commit:(BOOL)commit error:(NSError **)error NS_AVAILABLE(10_8, 5_0) __WATCHOS_PROHIBITED;
/*!
@method removeCalendar:commit:error:
@abstract Removes a calendar from the database.
@discussion This method attempts to delete the given calendar from the calendar database. It
returns YES if successful and NO otherwise. Passing a calendar fetched from
another EKEventStore instance into this function will raise an exception.
If the calendar supports multiple entity types (allowedEntityTypes), but the user has
not granted you access to all those entity types, then we will delete all of the entity types
for which you have access and remove that entity type from the allowedEntityTypes.
For example: If a calendar supports both events and reminders, but you only have access to reminders,
we will delete all the reminders and make the calendar only support events.
If you have access to all of its allowedEntityTypes, then it will delete the calendar and
all of the events and reminders in the calendar.
On WatchOS, modifying the database is not supported.
@param calendar The calendar to delete.
@param commit Pass YES to cause the database to save. You can pass NO to batch multiple
changes and then call commit: to save them all at once.
@param error If an error occurs, this will contain a valid NSError object on exit.
*/
- (BOOL)removeCalendar:(EKCalendar *)calendar commit:(BOOL)commit error:(NSError **)error NS_AVAILABLE(10_8, 5_0) __WATCHOS_PROHIBITED;
//----------------------------------------------------
// CALENDAR ITEMS (apply to both reminders and events)
//----------------------------------------------------
/*!
@method calendarItemWithIdentifier:
@abstract Returns either a reminder or the first occurrence of an event.
*/
- (nullable EKCalendarItem *)calendarItemWithIdentifier:(NSString *)identifier NS_AVAILABLE(10_8, 6_0);
/*!
@method calendarItemsWithExternalIdentifier:
@abstract Returns either matching reminders or the first occurrences of any events matching
the given external identifier.
@discussion This method returns a set of EKEvents or EKReminders with the given external identifier.
Due to reasons discussed in -[EKCalendarItem calendarItemExternalIdentifier], there may be
more than one matching calendar item.
@param externalIdentifier The value obtained from EKCalendarItem's
calendarItemExternalIdentifier property
@result An unsorted array of EKCalendarItem instances
*/
- (NSArray<EKCalendarItem *> *)calendarItemsWithExternalIdentifier:(NSString *)externalIdentifier NS_AVAILABLE(10_8, 6_0);
//----------------------------------------------------
// EVENTS
//----------------------------------------------------
/*!
@method saveEvent:span:error:
@abstract Saves changes to an event permanently.
@discussion This method attempts to save the event to the calendar database. It returns YES if
successful and NO otherwise. It's possible for this method to return NO, and error
will be set to nil. This occurs if the event wasn't dirty and didn't need saving. This
means the correct way to detect failure is a result of NO and a non-nil error parameter.
Passing an event fetched from another EKEventStore instance into this function will
raise an exception.
After an event is successfully saved, it is also put into sync with the database, meaning
that all fields you did not change will be updated to the latest values. If you save the
event, but it was deleted by a different store/process, you will effectively recreate the
event as a new event.
On WatchOS, saving changes is not supported.
@param event The event to save.
@param span The span to use (this event, or this and future events).
@param error If an error occurs, this will contain a valid NSError object on exit.
*/
- (BOOL)saveEvent:(EKEvent *)event span:(EKSpan)span error:(NSError **)error NS_AVAILABLE(10_14, 4_0) __WATCHOS_PROHIBITED;
/*!
@method removeEvent:span:error:
@abstract Removes an event from the calendar store.
@discussion This method attempts to remove the event from the calendar database. It returns YES if
successful and NO otherwise. It's possible for this method to return NO, and error
will be set to nil. This occurs if the event wasn't ever added and didn't need removing. This
means the correct way to detect failure is a result of NO and a non-nil error parameter.
Passing an event from another CalendarStore into this function will raise an exception. After
an event is removed, it is no longer tied to this calendar store, and all data in the event
is cleared except for the eventIdentifier.
On WatchOS, modifying the database is not supported.
@param event The event to save.
@param span The span to use (this event, or this and future events).
@param error If an error occurs, this will contain a valid NSError object on exit.
*/
- (BOOL)removeEvent:(EKEvent *)event span:(EKSpan)span error:(NSError **)error NS_AVAILABLE(10_14, 4_0) __WATCHOS_PROHIBITED;
// These variants of the above allow you to batch changes by passing NO to commit. You can commit
// all changes later with [EKEventStore commit:]
- (BOOL)saveEvent:(EKEvent *)event span:(EKSpan)span commit:(BOOL)commit error:(NSError **)error NS_AVAILABLE(10_8, 5_0) __WATCHOS_PROHIBITED;
- (BOOL)removeEvent:(EKEvent *)event span:(EKSpan)span commit:(BOOL)commit error:(NSError **)error NS_AVAILABLE(10_8, 5_0) __WATCHOS_PROHIBITED;
/*!
@method eventWithIdentifier:
@abstract Returns the first occurrence of an event matching the given event identifier.
@param identifier The eventIdentifier to search for.
@result An EKEvent object, or nil if not found.
*/
- (nullable EKEvent *)eventWithIdentifier:(NSString *)identifier;
/*!
@method eventsMatchingPredicate:
@abstract Searches for events that match the given predicate.
@discussion This call executes a search for the events indicated by the predicate passed to it.
It only includes events which have been committed (e.g. those saved using
saveEvent:commit:NO are not included until commit: is called.)
It is synchronous. If you want async behavior, you should either use dispatch_async or
NSOperation to run the query someplace other than the main thread, and then funnel the
array back to the main thread.
@param predicate The predicate to invoke. If this predicate was not created with the predicate
creation functions in this class, an exception is raised.
@result An array of EKEvent objects, or nil. There is no guaranteed order to the events.
*/
- (NSArray<EKEvent *> *)eventsMatchingPredicate:(NSPredicate *)predicate;
/*!
@method enumerateEventsMatchingPredicate:usingBlock:
@abstract Searches for events that match the given predicate.
@discussion This call executes a search for the events indicated by the predicate passed to it, calling
the block specified in the callback parameter for each event. It only includes events which
have been committed (e.g. those saved using saveEvent:commit:NO are not included until commit: is called.)
This method is synchronous. If you want async behavior, you should either use dispatch_async or
NSOperation to run the query someplace other than the main thread.
@param predicate The predicate to invoke. If this predicate was not created with the predicate
creation functions in this class, an exception is raised.
@param block The block to call for each event. Your block should return YES in the stop
parameter to stop iterating.
*/
- (void)enumerateEventsMatchingPredicate:(NSPredicate *)predicate usingBlock:(EKEventSearchCallback)block;
/*!
@method predicateForEventsWithStartDate:endDate:calendars:
@abstract Creates a predicate for use with eventsMatchingPredicate or enumerateEventsMatchingPredicate:usingBlock:.
@discussion Creates a simple query predicate to search for events within a certain date range. At present,
this will return events in the default time zone ([NSTimeZone defaultTimeZone]).
For performance reasons, this method will only return events within a four year timespan.
If the date range between the startDate and endDate is greater than four years, then it will be shortened
to the first four years.
@param startDate The start date.
@param endDate The end date.
@param calendars The calendars to search for events in, or nil to search all calendars.
*/
- (NSPredicate *)predicateForEventsWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate calendars:(nullable NSArray<EKCalendar *> *)calendars;
//----------------------------------------------------
// REMINDERS
//----------------------------------------------------
/*!
@method saveReminder:commit:error:
@abstract Saves changes to a reminder.
@discussion This method attempts to save the reminder to the event store database. It returns YES if
successful and NO otherwise. Passing a reminder fetched from another EKEventStore instance
into this function will raise an exception.
After a reminder is successfully saved, its fields are updated to the latest values in
the database.
On WatchOS, saving changes is not supported.
@param reminder The reminder to save.
@param commit Whether to save to the database or not. Pass NO to batch changes together and
commit with [EKEventStore commit:].
@param error If an error occurs, this will contain a valid NSError object on exit.
*/
- (BOOL)saveReminder:(EKReminder *)reminder commit:(BOOL)commit error:(NSError **)error NS_AVAILABLE(10_8, 6_0) __WATCHOS_PROHIBITED;
/*!
@method removeReminder:commit:error:
@abstract Removes a reminder from the event store.
@discussion This method attempts to remove the reminder from the event store database. It returns YES if
successful and NO otherwise. Passing a reminder from another EKEventStore into this function
will raise an exception. After a reminder is removed, it is no longer tied to this event store.
On WatchOS, modifying the database is not supported.
@param reminder The reminder to save.
@param commit Whether to save to the database or not. Pass NO to batch changes together and
commit with [EKEventStore commit:].
@param error If an error occurs, this will contain a valid NSError object on exit.
*/
- (BOOL)removeReminder:(EKReminder *)reminder commit:(BOOL)commit error:(NSError **)error NS_AVAILABLE(10_8, 6_0) __WATCHOS_PROHIBITED;
/*!
@method fetchRemindersMatchingPredicate:completion:
@abstract Fetches reminders asynchronously.
@discussion This method fetches reminders asynchronously and returns a value which can be
used in cancelFetchRequest: to cancel the request later if desired. The completion
block is called with an array of reminders that match the given predicate (or potentially nil).
This only includes reminders which have been committed (e.g. those saved using
saveReminder:commit:NO are not included until commit: is called.)
*/
- (id)fetchRemindersMatchingPredicate:(NSPredicate *)predicate completion:(void (^)(NSArray<EKReminder *> * __nullable reminders))completion NS_AVAILABLE(10_8, 6_0);
/*!
@method cancelFetchRequest:
@discussion Given a value returned from fetchRemindersMatchingPredicate, this method can be used to
cancel the request. Once called, the completion block specified in fetchReminders... will
not be called.
*/
- (void)cancelFetchRequest:(id)fetchIdentifier NS_AVAILABLE(10_8, 6_0);
/*!
@method predicateForRemindersInCalendars:
@abstract Fetch all reminders in a set of calendars.
@discussion You can pass nil for calendars to fetch from all available calendars.
*/
- (NSPredicate *)predicateForRemindersInCalendars:(nullable NSArray<EKCalendar *> *)calendars NS_AVAILABLE(10_8, 6_0);
/*!
@method predicateForIncompleteRemindersWithDueDateStarting:ending:calendars:
@abstract Fetch incomplete reminders in a set of calendars.
@discussion You can use this method to search for incomplete reminders due in a range.
You can pass nil for start date to find all reminders due before endDate.
You can pass nil for both start and end date to get all incomplete reminders
in the specified calendars.
You can pass nil for calendars to fetch from all available calendars.
*/
- (NSPredicate *)predicateForIncompleteRemindersWithDueDateStarting:(nullable NSDate *)startDate ending:(nullable NSDate *)endDate calendars:(nullable NSArray<EKCalendar *> *)calendars NS_AVAILABLE(10_8, 6_0);
/*!
@method predicateForCompletedRemindersWithCompletionDateStarting:ending:calendars:
@abstract Fetch completed reminders in a set of calendars.
@discussion You can use this method to search for reminders completed between a range of dates.
You can pass nil for start date to find all reminders completed before endDate.
You can pass nil for both start and end date to get all completed reminders
in the specified calendars.
You can pass nil for calendars to fetch from all available calendars.
*/
- (NSPredicate *)predicateForCompletedRemindersWithCompletionDateStarting:(nullable NSDate *)startDate ending:(nullable NSDate *)endDate calendars:(nullable NSArray<EKCalendar *> *)calendars NS_AVAILABLE(10_8, 6_0);
//----------------------------------------------------
// COMMIT, RESET, ROLLBACK
//----------------------------------------------------
/*!
@method commit:
@abstract Commits pending changes to the database.
@discussion If you use saveCalendar/saveEvent/removeCalendar/removeEvent, etc. and you pass NO to their
parameter, you are batching changes for a later commit. This method does that commit. This
allows you to save the database only once for many additions or changes. If you pass
YES to methods' commit parameter, then you don't need to call this method.
This method will return YES as long as nothing went awry, even if nothing was actually
committed. If it returns NO, error should contain the reason it became unhappy.
On WatchOS, modifying the database is not supported.
*/
- (BOOL)commit:(NSError **)error NS_AVAILABLE(10_8, 5_0) __WATCHOS_PROHIBITED;
/*!
@method reset
@abstract Resets the event store.
@discussion You can use this method to forget ALL changes made to the event store (all additions, all
fetched objects, etc.). It essentially is as if you released the store and then created a
new one. It brings it back to its initial state. All objects ever created/fetched, etc.
using this store are no longer connected to it and are considered invalid.
*/
- (void)reset NS_AVAILABLE(10_8, 5_0);
/*!
@method refreshSourcesIfNecessary
@abstract Cause a sync to potentially occur taking into account the necessity of it.
@discussion You can call this method to pull new data from remote sources.
This only updates the event store's data. If you want to update your objects after
refreshing the sources, you should call refresh on each of them afterwards.
On iOS, this sync only occurs if deemed necessary.
On OS X, this will occur regardless of necessity, but may change in a future release to match the iOS behavior.
On WatchOS, initiating sync is not available. Sync will occur automatically with the paired iOS device.
*/
- (void)refreshSourcesIfNecessary NS_AVAILABLE(10_8, 5_0) __WATCHOS_PROHIBITED;
@end
/*!
@constant EKEventStoreChangedNotification
@discussion Notification name sent out when the database is changed by either an external process,
another event store in the same process, or by calling saveEvent: or removeEvent: on a
store you are managing. When you receive this notification, you should consider all EKEvent
instances you have to be invalid. If you had selected events for a date range using
eventsMatchingPredicate, etc. for display, you should release them and re-fetch the events
again. If you have an event you are actively using (e.g. you are currently viewing details
for it or editing it), you can call [EKEvent refresh] to try to revalidate it against the
latest state of the database. If that method returns YES, you can continue to use the event,
otherwise, you should release it and abandon what you were doing with it. The view
controllers provided by EventKitUI automatically deal with this for you.
This notification will also be posted if access to events or reminders is changed by the user.
*/
EVENTKIT_EXTERN NSString *const EKEventStoreChangedNotification NS_AVAILABLE(10_8, 4_0);
NS_ASSUME_NONNULL_END
// ========== EventKit.framework/Headers/EKObject.h
//
// EKObject.h
// EventKit
//
// Copyright 2011 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface EKObject : NSObject
// Returns YES if this object or any sub-object (alarm, etc.) has uncommitted changes.
@property (nonatomic, readonly) BOOL hasChanges;
// Returns YES if this object has never been saved.
#if defined(__cplusplus)
- (BOOL)isNew;
#else
@property (nonatomic, readonly, getter=isNew) BOOL new;
#endif
// If this object is not new, this method will unload all loaded properties and clear any dirty state
- (void)reset;
// If this object is not new, this method will unload dirty state only.
- (void)rollback;
// Determines if the object is still valid (i.e. it still exists in the database), and unloads all
// properties that have not been modified. If this ever returns NO, it indicates the record was deleted
// and this instance should be discarded and no longer referenced.
- (BOOL)refresh;
@end
// ========== EventKit.framework/Headers/EKReminder.h
//
// EKReminder.h
// EventKit
//
// Copyright 2010 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <EventKit/EventKitDefines.h>
#import <EventKit/EKCalendarItem.h>
NS_ASSUME_NONNULL_BEGIN
@class EKEventStore, EKCalendar, EKRecurrenceRule, EKAlarm;
/*!
@class EKReminder
@abstract The EKReminder class represents a reminder (task/todo).
*/
NS_CLASS_AVAILABLE(10_8, 6_0)
@interface EKReminder : EKCalendarItem
/*!
@method reminderWithEventStore:
@abstract Creates a new reminder in the given event store.
*/
+ (EKReminder *)reminderWithEventStore:(EKEventStore *)eventStore;
/*!
@property startDateComponents
@abstract The start date of the task, as date components.
@discussion The use of date components allows the start date and its time zone to be represented in a single property.
A nil time zone represents a floating date. Setting a date component without a hour, minute and second component will set allDay to YES.
If you set this property, the calendar must be set to NSCalendarIdentifierGregorian. An exception is raised otherwise.
*/
@property(nonatomic, copy, nullable) NSDateComponents *startDateComponents;
/*!
@property dueDateComponents
@abstract The date by which this reminder should be completed.
@discussion The use of date components allows the due date and its time zone to be represented in a single property.
A nil time zone represents a floating date. Setting a date component without a hour, minute and second component will set allDay to YES.
If you set this property, the calendar must be set to NSCalendarIdentifierGregorian. An exception is raised otherwise.
On iOS, if you set the due date for a reminder, you must also set a start date, otherwise you will receive
an error (EKErrorNoStartDate) when attempting to save this reminder. This is not a requirement on OS X.
*/
@property(nonatomic, copy, nullable) NSDateComponents *dueDateComponents;
// These two properties are inextricably linked. Setting completed to be YES, will set the completedDate to be now,
// and setting any completedDate will change completed to be YES. Similarly, setting completed to be NO will set
// the completedDate to be nil, and setting the completedDate changes completed to NO.
// Note, you may encounter the case where isCompleted is YES, but completionDate is nil, if the reminder was completed using a different client.
/*!
@property completed
@abstract Whether or not the reminder is completed.
@discussion Setting it to YES will set the completed date to the current date.
Setting it to NO will set the completed date to nil.
*/
@property(nonatomic, getter=isCompleted) BOOL completed;
/*!
@property completionDate
@abstract The date on which this reminder was completed.
*/
@property(nonatomic, copy, nullable) NSDate *completionDate;
/*!
@property priority
@abstract The priority of the reminder.
@discussion Priorities run from 1 (highest) to 9 (lowest). A priority of 0 means no priority.
Saving a reminder with any other priority will fail.
Per RFC 5545, priorities of 1-4 are considered "high," a priority of 5 is "medium," and priorities of 6-9 are "low."
*/
@property(nonatomic) NSUInteger priority;
@end
NS_ASSUME_NONNULL_END
// ========== EventKit.framework/Headers/EKRecurrenceRule.h
//
// EKRecurrenceRule.h
// EventKit
//
// Copyright 2009-2010 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <EventKit/EventKitDefines.h>
#import <EventKit/EKRecurrenceEnd.h>
#import <EventKit/EKRecurrenceDayOfWeek.h>
#import <EventKit/EKTypes.h>
#import <EventKit/EKObject.h>
NS_ASSUME_NONNULL_BEGIN
@class EKEventStore, EKCalendarItem;
/*!
@class EKRecurrenceRule
@abstract Represents how an event repeats.
@discussion This class describes the recurrence pattern for a repeating event. The recurrence rules that
can be expressed are not restricted to the recurrence patterns that can be set in Calendar's UI.
It is currently not possible to directly modify a EKRecurrenceRule or any of its properties.
This functionality is achieved by creating a new EKRecurrenceRule, and setting an event to use the new rule.
When a new recurrence rule is set on an EKEvent, that change is not saved until the client
has passed the modified event to EKEventStore's saveEvent: method.
*/
NS_CLASS_AVAILABLE(10_8, 4_0)
@interface EKRecurrenceRule : EKObject <NSCopying>
/*!
@method initRecurrenceWithFrequency:interval:end:
@abstract Simple initializer to create a recurrence.
@discussion This is used to create a simple recurrence with a specific type, interval and end. If interval is
0, an exception is raised. The end parameter can be nil.
*/
- (instancetype)initRecurrenceWithFrequency:(EKRecurrenceFrequency)type interval:(NSInteger)interval end:(nullable EKRecurrenceEnd *)end;
/*!
@method initRecurrenceWithFrequency:interval:daysOfTheWeek:daysOfTheMonth:monthsOfTheYear:weeksOfTheYear:daysOfTheYear:setPositions:end:
@abstract The designated initializer.
@discussion This can be used to build any kind of recurrence rule. But be aware that certain combinations make
no sense and will be ignored. For example, if you pass daysOfTheWeek for a daily recurrence, they
will be ignored.
@param type The type of recurrence
@param interval The interval. Passing zero will raise an exception.
@param daysOfTheWeek An array of EKRecurrenceDayOfWeek objects. Valid for all recurrence types except daily. Ignored otherwise.
Corresponds to the BYDAY value in the iCalendar specification.
@param daysOfTheMonth An array of NSNumbers ([+/-] 1 to 31). Negative numbers infer counting from the end of the month.
For example, -1 means the last day of the month. Valid only for monthly recurrences. Ignored otherwise.
Corresponds to the BYMONTHDAY value in the iCalendar specification.
@param monthsOfTheYear An array of NSNumbers (1 to 12). Valid only for yearly recurrences. Ignored otherwise. Corresponds to
the BYMONTH value in the iCalendar specification.
@param weeksOfTheYear An array of NSNumbers ([+/1] 1 to 53). Negative numbers infer counting from the end of the year.
For example, -1 means the last week of the year. Valid only for yearly recurrences. Ignored otherwise.
Corresponds to the BYWEEKNO value in the iCalendar specification.
@param daysOfTheYear An array of NSNumbers ([+/1] 1 to 366). Negative numbers infer counting from the end of the year.
For example, -1 means the last day of the year. Valid only for yearly recurrences. Ignored otherwise.
Corresponds to the BYYEARDAY value in the iCalendar specification.
@param setPositions An array of NSNumbers ([+/1] 1 to 366). Used at the end of recurrence computation to filter the list
to the positions specified. Negative numbers indicate starting at the end, i.e. -1 indicates taking the
last result of the set. Valid when daysOfTheWeek, daysOfTheMonth, monthsOfTheYear, weeksOfTheYear, or
daysOfTheYear is passed. Ignored otherwise. Corresponds to the BYSETPOS value in the iCalendar specification.
@param end The recurrence end, or nil.
*/
- (instancetype)initRecurrenceWithFrequency:(EKRecurrenceFrequency)type
interval:(NSInteger)interval
daysOfTheWeek:(nullable NSArray<EKRecurrenceDayOfWeek *> *)days
daysOfTheMonth:(nullable NSArray<NSNumber *> *)monthDays
monthsOfTheYear:(nullable NSArray<NSNumber *> *)months
weeksOfTheYear:(nullable NSArray<NSNumber *> *)weeksOfTheYear