ScheduleDefinition
open class ScheduleDefinition
Allows selecting date-time intervals by specifying week and day intervals, and optionally excluding time intervals returned by a specific function.
-
Initializes a schedule definition, optionally with a client provider object to return the week interval, day interval, and excluded intervals within a specific interval passed to a function of the object upon request.
Declaration
Swift
public init(provider: ScheduleDefinitionProvider? = nil)
-
Selects an interval between two days of week to consider for each week.
Declaration
Swift
open var weekInterval: WeekRange { get }
-
Selects an interval between two times of day to consider for each selected day.
Declaration
Swift
open var dayInterval: DayRange { get }
-
Returns the date-time intervals to be considered as excluded from the selected time for the value and towards the limit received as arguments. Only the interval(s) that contain or are closest to the input time towards the specified limit need to actually be returned. For any partition of the input interval, the aggregating results of the function applied to its individual parts should correspond to the result of the function applied to the entire interval.
-
Offers optimizations when excluded intervals aren’t possible.
Declaration
Swift
open var hasExcludedIntervals: Bool { get }
-
Optional external data provider for week, day, and excluded intervals to use upon scheduling.
Declaration
Swift
public weak var provider: ScheduleDefinitionProvider?
-
Returns the duration of a date-time interval according to the scheduling logic (in seconds).
Declaration
Swift
public func duration(of interval: TimeRange) -> TimeInterval
-
Returns the number of scheduled hours per day considering the day interval definition (and disregarding excluded intervals).
Declaration
Swift
public var hoursPerDay: Double { get }
-
Returns the number of scheduled days per week considering the week interval definition (and disregarding excluded intervals).
Declaration
Swift
public var daysPerWeek: Int { get }
-
Returns the number of scheduled hours per week considering the day and week interval definitions (and disregarding excluded intervals).
Declaration
Swift
public var hoursPerWeek: Double { get }
-
Returns the scheduled duration of a day considering the day interval definition (and disregarding excluded intervals).
Declaration
Swift
public var dayDuration: Double { get }
-
Returns the scheduled duration of a week considering the day and week interval definitions (and disregarding excluded intervals).
Declaration
Swift
public var weekDuration: Double { get }
-
Indicates whether all day time is scheduled (possibly not for all week days, though), considering the day interval definition (and disregarding excluded intervals).
Declaration
Swift
public var isFullDay: Bool { get }
-
Indicates whether all week days are scheduled (possibly not all day time, though), considering the week interval definition (and disregarding excluded intervals).
Declaration
Swift
public var isFullWeek: Bool { get }
-
Indicates whether all day time of all week days is scheduled, considering the day and week interval definitions (and disregarding excluded intervals).
Declaration
Swift
public var isContinuous: Bool { get }
-
Indicates whether a specified date-time interval is continuously scheduled considering the excluded intervals for that interval (and assuming continuous day and week interval definitions).
Declaration
Swift
public func isContinuous(during interval: TimeRange) -> Bool
-
Returns a schedule object representing the intersection of the current scheduling logic with the specified schedule definition when week and day intervals overlap.
Declaration
Swift
public func intersecting( _ definition: ScheduleDefinition) -> ScheduleIntersection?
-
Returns the schedule intersection between the current schedule and the specified definition when applicable or the current schedule itself otherwise.
Declaration
Swift
public func optionallyIntersecting( _ definition: ScheduleDefinition?) -> ScheduleDefinition
-
Schedules continuous time (24 hours/day, 7 days/week).
Declaration
Swift
static let continuous: Schedule
-
Schedules time between 8 AM and 4 PM, Monday to Friday (8 hours/day, 5 days/week).
Declaration
Swift
static let standard: Schedule
-
Schedules time between 8 AM and 4 PM for all week days (8 hours/day, 7 days/week).
Declaration
Swift
static let fullWeek: Schedule
-
Schedules continuous time between Monday and Friday (24 hours/day, 5 days/week).
Declaration
Swift
static let fullDay: Schedule