You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// !!! The interface as exposed by Darwin marks init(fire date: Date, interval: TimeInterval, repeats: Bool, block: @escaping (Timer) -> Swift.Void) with "convenience", but this constructor without.
56
+
// !!! That doesn't make sense as init(fire date: Date, ...) is more general than this constructor, which can be implemented in terms of init(fire date: Date, ...).
57
+
// !!! The convenience here has been switched around and deliberately does not match what is exposed by Darwin Foundation.
58
+
/// Creates and returns a new Timer object initialized with the specified block object.
59
+
/// - parameter: timeInterval The number of seconds between firings of the timer. If seconds is less than or equal to 0.0, this method chooses the nonnegative value of 0.1 milliseconds instead
60
+
/// - parameter: repeats If YES, the timer will repeatedly reschedule itself until invalidated. If NO, the timer will be invalidated after it fires.
61
+
/// - parameter: block The execution body of the timer; the timer itself is passed as the parameter to this block when executed to aid in avoiding cyclical references
/// Alternative API for timer creation with a block.
56
67
/// - Experiment: This is a draft API currently under consideration for official import into Foundation as a suitable alternative to creation via selector
57
68
/// - Note: Since this API is under consideration it may be either removed or revised in the near future
@@ -63,7 +74,7 @@ open class Timer: NSObject {
63
74
}
64
75
65
76
openfunc fire(){
66
-
if !valid{
77
+
if !isValid{
67
78
return
68
79
}
69
80
_fire(self)
@@ -98,7 +109,13 @@ open class Timer: NSObject {
98
109
CFRunLoopTimerInvalidate(_timer!)
99
110
}
100
111
101
-
openvarvalid:Bool{
112
+
openvarisValid:Bool{
102
113
returnCFRunLoopTimerIsValid(_timer!)
103
114
}
115
+
116
+
// Timer's userInfo is meant to be read-only. The initializers that are exposed on Swift, however, do not take a custom userInfo, so it can never be set.
117
+
// The default value should then be nil, and this is left as subclassable for potential consumers.
0 commit comments