init
TypeScriptstatic init(object: CMTimebase): CMTimebaseSwift declarationinit(referencing object: CMTimebase)class · iOS 6.0+ · SDK 27.1
class CMTimebasestatic init(object: CMTimebase): CMTimebaseSwift declarationinit(referencing object: CMTimebase)static get timeJumped(): _Foundation_NSNotification_NameSwift declarationstatic let timeJumped: NSNotification.NamePosted by a timebase after a discontinuous time jump.
get masterClock(): (CMClock) | nullSwift declarationvar masterClock: CMClock? { get }Deprecated synonym for sourceClock.
removeTimer(timer: _Foundation_Timer): voidSwift declarationfunc removeTimer(_ timer: Timer) throwsRemoves the timer from the list of timers managed by the timebase. The timebase will no longer maintain the timer's "NextFireDate". If the timer is invalidated, the timebase will eventually remove it from its list and release it even if this function is not called.
removeTimer62076(timer: _Dispatch_DispatchSource): voidSwift declarationfunc removeTimer<T>(_ timer: T) throws where T : DispatchSourceTimerRemoves the timer dispatch source from the list of timers managed by the timebase. The timebase will no longer maintain the timer source's start time. If the timer source is cancelled, the timebase will eventually remove it from its list and release it even if this function is not called.
get sourceClock(): (CMClock) | nullSwift declarationvar sourceClock: CMClock? { get }Returns the immediate source clock. Returns `nil` if the timebase actually has a source timebase instead of a source clock.
get timeAndRate(): { "time": CMTime; "rate": number }Swift declarationvar timeAndRate: (time: CMTime, rate: Double) { get }The current time and rate. You can use this to take a consistent snapshot of the two values, avoiding possible inconsistencies due to external changes between retrieval of `time` and `rate`.
get effectiveRate(): numberSwift declarationvar effectiveRate: Double { get }The effective rate (which combines its rate with the rates of all its master timebases). Calling `timebase.effectiveRate` is equivalent to calling `timebase.rate(relativeTo: timebase.ultimateMasterClock)`
setAnchorTime(anchorTime: CMTime, referenceTime: CMTime): voidSwift declarationfunc setAnchorTime(_ anchorTime: CMTime, referenceTime: CMTime) throwsSets the time at a particular master time. `time` will be interpolated from that anchor time. `timebase.setTime(time)` is equivalent to calling `timebase.setAnchorTime(time, timebase.master.time)`
get masterTimebase(): (CMTimebase) | nullSwift declarationvar masterTimebase: CMTimebase? { get }Deprecated synonym for sourceTimebase.
get sourceTimebase(): (CMTimebase) | nullSwift declarationvar sourceTimebase: CMTimebase? { get }The immediate source timebase. Returns `nil` if the timebase actually has a source clock instead of a source timebase.
notificationBarrier(): voidSwift declarationfunc notificationBarrier() throwsRequests that the timebase wait until it is not posting any notifications.
get ultimateMasterClock(): CMClockSwift declarationvar ultimateMasterClock: CMClock { get }Deprecated synonym for ultimateSourceClock.
get ultimateSourceClock(): CMClockSwift declarationvar ultimateSourceClock: CMClock { get }The source clock that is the source of all of the source timebases.
static get effectiveRateChanged(): _Foundation_NSNotification_NameSwift declarationstatic let effectiveRateChanged: NSNotification.NamePosted by a timebase after a change in effective rate.
setRateAndAnchorTime(rate: number, anchorTime: CMTime, referenceTime: CMTime): voidSwift declarationfunc setRateAndAnchorTime(rate: Double, anchorTime: CMTime, referenceTime: CMTime) throwsSets the time at a particular master time, and changes the rate at exactly that time. `time` will be interpolated from that anchor time as though the timebase has been running at the requested rate since that time. `timebase.setRate(rate)` is approximately equivalent to calling ``` timebase.setRateAndAnchorTime(rate: rate, anchorTime: timebase.time, referenceTime: timebase.master.time) ``` except that `setRate` will not generate a `TimeJumped` notification, and `setRateAndAnchorTime` will.
setTimerNextFireTimeFireTime(timer: _Foundation_Timer, fireTime: CMTime): voidSwift declarationfunc setTimerNextFireTime(_ timer: Timer, fireTime: CMTime) throwsSets the `CMTime` on the timebase's timeline at which the timer should next be fired. The timer must be on the list of timers managed by the timebase. The timebase will continue to update the timer's "NextFireDate" according to time jumps and effective rate changes. If `fireTime` is not numeric, or if the timebase is not moving, the "NextFireDate" will be set to a date far, far in the future. IMPORTANT NOTE: Due to the way that `CFRunLoopTimer`s are implemented, if a timer passes through a state in which it is due to fire, it may fire even if its rescheduled before the runloop runs again. Clients should take care to avoid temporarily scheduling timers in the past. For example, set the timebase's rate or time before you set the timer's next fire time, if you are doing both at once. (If setting the timebase's rate or time might put the timer's fire time in the past, you may need to set the fire time to `CMTime.invalid` across the timebase change.)
setTimerNextFireTimeFireTime78006(timer: _Dispatch_DispatchSource, fireTime: CMTime): voidSwift declarationfunc setTimerNextFireTime<T>(_ timer: T, fireTime: CMTime) throws where T : DispatchSourceTimerSets the `CMTime` on the timebase's timeline at which the timer dispatch source should next be fired. The timer source must be on the list of timers managed by the timebase. The timebase will continue to update the timer dispatch source's start time according to time jumps and effective rate changes. If `fireTime` is not numeric, or if the timebase is not moving, the start time will be set to `DispatchTime.distantFuture`. IMPORTANT NOTE: Due to the way that timer dispatch sources are implemented, if a timer passes through a state in which it is due to fire, it may fire even if its rescheduled before the event handler is run. Clients should take care to avoid temporarily scheduling timers in the past. For example, set the timebase's rate or time before you set the timer's next fire time, if you are doing both at once. (If setting the timebase's rate or time might put the timer's fire time in the past, you may need to set the fire time to `CMTime.invalid` across the timebase change.)
static get veryLongTimeInterval(): numberSwift declarationstatic let veryLongTimeInterval: CFTimeIntervalQuite a while (256 years).
setTimerToFireImmediately(timer: _Foundation_Timer): voidSwift declarationfunc setTimerToFireImmediately(_ timer: Timer) throwsSets the timer to fire immediately once, overriding any previous `setTimerNextFireTime` call. The timer must be on the list of timers managed by the timebase. This is equivalent to calling `CFRunLoopTimerSetNextFireDate(timer, CFAbsoluteTimeGetCurrent())` except that the timebase gets to know that it shouldn't interfere.
setTimerToFireImmediately4442(timer: _Dispatch_DispatchSource): voidSwift declarationfunc setTimerToFireImmediately<T>(_ timer: T) throws where T : DispatchSourceTimerSets the timer dispatch source to fire immediately once, overriding any previous `setTimerNextFireTime` call. The timer source must be on the list of timers managed by the timebase. This is equivalent to calling `timerSource.schedule(deadline: DispatchTime.now())` except that the timebase gets to know that it shouldn't interfere.
get rate(): numberSwift declarationvar rate: Double { get }The current rate. This is the rate relative to its immediate master clock or timebase. For example, if a timebase is running at twice the rate of its master, its rate is 2.0.
timeWithTimescaleRounding(timescale: number, rounding?: CMTimeRoundingMethod): CMTimeSwift declarationfunc time(withTimescale timescale: CMTimeScale, rounding: CMTimeRoundingMethod = .`default`) -> CMTimeRetrieves the current time in the specified timescale.
get time(): CMTimeSwift declarationvar time: CMTime { get }The current time.
get master(): SDKHandleSwift declarationvar master: any CMSyncProtocol { get set }Deprecated synonym for source.
set master(value: SDKHandle)Swift declarationvar master: any CMSyncProtocol { get set }Deprecated synonym for source.
get source(): SDKHandleSwift declarationvar source: any CMSyncProtocol { get set }Returns the immediate source (either timebase or clock).
set source(value: SDKHandle)Swift declarationvar source: any CMSyncProtocol { get set }Returns the immediate source (either timebase or clock).
static get typeID(): numberSwift declarationstatic var typeID: CFTypeID { get }The `CFTypeID` corresponding to `CMTimebase`.
setRate(rate: number): voidSwift declarationfunc setRate(_ rate: Double) throwsSets the rate.
setTime(time: CMTime): voidSwift declarationfunc setTime(_ time: CMTime) throwsSets the current time.
addTimerOn(timer: _Foundation_Timer, runloop: _Foundation_RunLoop): voidSwift declarationfunc addTimer(_ timer: Timer, on runloop: RunLoop) throwsAdds the timer to the list of timers managed by the timebase. The timer must be a repeating run loop timer (with a very long interval at least as long as .veryLongTimeInterval), attached to a runloop. The timebase will retain the timer, and will maintain its "NextFireDate" according to the `CMTime` set using `setTimerNextFireTime`. Until the first call to `setTimerNextFireTime`, the "NextFireDate" will be set far, far in the future. The runloop that timer is attached to must be passed in and the timebase will retain that runloop. The retained runloop will be used to call `CFRunLoopWakeUp()` any time the timebase modifies the timer's fire date.
addTimer(timer: _Dispatch_DispatchSource): voidSwift declarationfunc addTimer<T>(_ timer: T) throws where T : DispatchSourceTimerAdds the timer dispatch source to the list of timers managed by the timebase. The timer source must have been created by calling `DispatchSource.makeTimerSource(flags: [], queue: some_dispatch_queue)` and should have had an event handler associated with it via `timerSource.setEventHandler { /* timer fired */ } Don't forget to call `timerSource.activate()` as dispatch sources are created in an inactive state. The timebase will retain the timer source, and will maintain its start time according to the `CMTime` set using `setTimerNextFireTime`. Until the first call to `setTimerNextFireTime`, the start time will be set to `DispatchTime.distantFuture`.
static get farFuture(): numberSwift declarationstatic let farFuture: CFAbsoluteTimeQuite a while from 2001 (2257).
5 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
CMTimebase.NotificationKey
The iOS SDK compiler rejected this binding: type 'CMTimebase.NotificationKey' does not conform to protocol 'OneSDKNamedConstants'
CMTimebase.rate(relativeTo:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
CMTimebase.rateAndAnchorTime(relativeTo:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
CMTimebase.convertTime(_:to:)
This declaration needs Swift generic type arguments. (no canonical witness for T)
CMTimebase.mightDrift(relativeTo:)
This declaration needs Swift generic type arguments. (no canonical witness for T)