OCKCareSchedule Class Reference

Inherits from NSObject
Conforms to NSCopying
NSSecureCoding
Declared in OCKCareSchedule.h

An OCKCareSchedule class instance defines start and end dates, and the reccurrence pattern for an activity. OCKCareSchedule works only with the Gregorian calendar. You must convert date components that use another calendar to the Gregorian calendar before sending to OCKCareSchedule.

Subclass OCKCareSchedule to support other type of schedules. A subclass must implement numberOfEventsOnDate: and conform to the NSSecureCoding and NSCopying protocols.

+ dailyScheduleWithStartDate:occurrencesPerDay:

Defines a schedule that has the same number of occurrences each day.

+ (instancetype)dailyScheduleWithStartDate:(NSDateComponents *)startDate occurrencesPerDay:(NSUInteger)occurrencesPerDay

Parameters

startDate

Start date for a schedule, using the Gregorian calendar.

occurrencesPerDay

Number of occurrences in each day.

Return Value

An OCKCareSchedule instance.

Discussion

You can set the end date later by using the CarePlanStore API.

Declared In

OCKCareSchedule.h

+ weeklyScheduleWithStartDate:occurrencesOnEachDay:

Defines a schedule that repeats every week.

+ (instancetype)weeklyScheduleWithStartDate:(NSDateComponents *)startDate occurrencesOnEachDay:(NSArray<NSNumber*> *)occurrencesFromSundayToSaturday

Parameters

startDate

Start date for a schedule, using the Gregorian calendar.

occurrencesFromSundayToSaturday

Number of occurrences for Sunday through Saturday.

Return Value

An OCKCareSchedule instance.

Discussion

Each weekday can have a different number of occurrences. You can set the end date later by using the CarePlanStore API.

Declared In

OCKCareSchedule.h

+ dailyScheduleWithStartDate:occurrencesPerDay:daysToSkip:endDate:

Defines a schedule that has the same number of occurrences every day.

+ (instancetype)dailyScheduleWithStartDate:(NSDateComponents *)startDate occurrencesPerDay:(NSUInteger)occurrencesPerDay daysToSkip:(NSUInteger)daysToSkip endDate:(nullable NSDateComponents *)endDate

Parameters

startDate

Start date for a schedule, using the Gregorian calendar.

occurrencesPerDay

Number of occurrences in each day.

daysToSkip

Number of days between two active days during this period for which the schedule has no occurrence. (That is, number of skipped days.) First day of a schedule is recognized as an active day.

endDate

End date for a schedule, , using the Gregorian calendar.

Return Value

An OCKCareSchedule instance.

Declared In

OCKCareSchedule.h

+ weeklyScheduleWithStartDate:occurrencesOnEachDay:weeksToSkip:endDate:

Defines a schedule that repeats every week.

+ (instancetype)weeklyScheduleWithStartDate:(NSDateComponents *)startDate occurrencesOnEachDay:(NSArray<NSNumber*> *)occurrencesFromSundayToSaturday weeksToSkip:(NSUInteger)weeksToSkip endDate:(nullable NSDateComponents *)endDate

Parameters

startDate

Start date for a schedule, using the Gregorian calendar.

occurrencesFromSundayToSaturday

Number of occurrences in each day.

weeksToSkip

Number of weeks between two active weeks during this period for which the schedule has no occurrence. (That is, number of skipped weeks.)

endDate

End date for a schedule, , using the Gregorian calendar.

Return Value

An OCKCareSchedule instance.

Discussion

Each weekday can have a different number of occurrences.

Declared In

OCKCareSchedule.h

  type

Type of schedule.

@property (nonatomic, readonly) OCKCareScheduleType type

Declared In

OCKCareSchedule.h

  startDate

Start date of schedule.

@property (nonatomic, readonly) NSDateComponents *startDate

Discussion

Gregorian calendar representation of a date. Only Era/Year/Month/Day attributes are observed. Date components in another calendar must be converted to the Gregorian calendar before using in an OCKCareSchedule object.

Declared In

OCKCareSchedule.h

  endDate

End date of schedule.

@property (nonatomic, readonly, nullable) NSDateComponents *endDate

Discussion

Gregorian calendar representation of a date. Only Era/Year/Month/Day attributes are observed. Date components in another calendar must be converted to the Gregorian calendar before using in an OCKCareSchedule object.

Declared In

OCKCareSchedule.h

  occurrences

How many occurrences in each day within the time range.

@property (nonatomic, copy, readonly) NSArray<NSNumber*> *occurrences

Discussion

Daily schedule has only one number in array. Weekly schedule has 7 numbers mapping from Sunday to Saturday.

Declared In

OCKCareSchedule.h

  timeUnitsToSkip

Number of inactive time units between two active time units. During this period, schedule has no occurrence.

@property (nonatomic, readonly) NSUInteger timeUnitsToSkip

Discussion

For daily schedule, first day of a schedule is recognized as an active day. For weekly schedule, first week of a schedule is recognized as an active week.

Declared In

OCKCareSchedule.h

– numberOfEventsOnDate:

How many events (occurrences) on a date.

- (NSUInteger)numberOfEventsOnDate:(NSDateComponents *)date

Parameters

date

Gregorian calendar representation of a date. Only Era/Year/Month/Day attributes are observed.

Return Value

The number of events on the specified date.

Declared In

OCKCareSchedule.h