TimeSequence
@objc public class TimeSequence: NSObject
A Chronos time sequence.
-
The Name of the Time Sequence
Declaration
Swift
public internal(set) var name: String = "" -
The list of time spans.
Declaration
Swift
public var timeSpans: [TimeSpan] = [] -
If an Interval can repeat this is how much time between both Start times before it can happen again. Keep in mind it’s the time between the first start and the second start.
Declaration
Swift
public var repetitionSeparation: Double = 0 -
How many times this interval repeats. -1 if it should repeat forever.
Declaration
Swift
public var repeatCount: Int32 = 0 -
This will get or set the current behavior of this timer.
Declaration
Swift
public var type: SequenceType = SequenceType.OneShot -
Used by the manager to find out if a Sequence was made by the user in code or by checking to see if they were created using the static create methods.
Declaration
Swift
public private(set) var userCreated: Bool = false -
Creates a new instance of a one-shot Time Sequence.
Declaration
Swift
public static func createOneShot(name: String, startTime: Double, endTime: Double) -> TimeSequenceParameters
nameThe name of the Time Sequence. Used to fetch it from
ChronosManger.getTimeInterval(name: String)startTimeThe time at which this timer will start.
endTimeThe time at which this timer will end.
Return Value
The new instance of the Time Sequence.
-
Creates a new instance of Time Sequence and set it up to be a recurring timer.
Declaration
Swift
public static func createRecurring(name: String, startTime: Double, endTime: Double, repetitionSeparation: Double, repeatCount: Int32 = RepeatRates.Indefinitely.rawValue) -> TimeSequenceParameters
nameThe name of the Time Sequence. Used to fetch it from
ChronosManger.getTimeInterval(name: String)startTimeThe time at which this timer will start.
endTimeThe time at which this timer will end.
repetitionSeparationThe delay before it starts again after one interval has been complete.
repeatCountHow many times this timer repeats. Use
RepeatRatesenum for constants.Return Value
The new instance of the Time Sequence.
-
Creates a new instance of Time Sequence and set it up to be a multi timer.
Declaration
Swift
public static func createMultiTime(name: String, timeSpans: [TimeSpan]) -> TimeSequenceParameters
nameThe name of the Time Sequence. Used to fetch it from
ChronosManger.getTimeInterval(name: String)timeSpansThe array of Time Spans.
Return Value
The new instance of the Time Sequence.
-
Initializes a
TimeSequenceobject from a json array.Valid JSON format:
{ "name": "string", "repetitionSeparation": "double", "repeatCount": "integer", "type": "string", "intervals": [{"startTime": "double", "endTime": "double"}], "startTime": "double", "endTime": "double", "duration": "double" }Note: all fields are optional and if omitted will use the default value for that property. duration is only used if endTime is not specified.
Declaration
Swift
public convenience init?(json: [String: Any])Parameters
jsonThe json object to parse.
-
Gets the end time of the current or next time span. If there are no more timespans after the currentTime, returns the endTime of the last timespan.
Declaration
Swift
public func endTime(currentTime: Double) -> DoubleParameters
currentTimeThe current time.
Return Value
The end time.
-
Gets the start time of the current or next time span. If there are no more timespans after the currentTime, returns the startTime of the last timespan.
Declaration
Swift
public func startTime(currentTime: Double) -> DoubleParameters
currentTimeThe current time.
Return Value
The start time.
-
Gets the duration of the current or next time span. If there are no more timespans after the currentTime, returns the duration of the last timespan.
Declaration
Swift
public func duration(currentTime: Double) -> DoubleParameters
currentTimeThe current time.
Return Value
The duration.
-
Send in a Unix time to find out if this Interval is currently active.
Declaration
Swift
public func isActive(currentTime: Double) -> BoolParameters
currentTimeThe current time.
Return Value
trueif this interval is active at the given time,falseotherwise.
TimeSequence Class Reference