objc2_foundation/generated/
NSTimer.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 #[unsafe(super(NSObject))]
12 #[derive(Debug, PartialEq, Eq, Hash)]
13 pub struct NSTimer;
14);
15
16unsafe impl NSObjectProtocol for NSTimer {}
17
18impl NSTimer {
19 extern_methods!(
20 #[cfg(all(feature = "NSDate", feature = "NSInvocation"))]
21 #[unsafe(method(timerWithTimeInterval:invocation:repeats:))]
22 #[unsafe(method_family = none)]
23 pub unsafe fn timerWithTimeInterval_invocation_repeats(
24 ti: NSTimeInterval,
25 invocation: &NSInvocation,
26 yes_or_no: bool,
27 ) -> Retained<NSTimer>;
28
29 #[cfg(all(feature = "NSDate", feature = "NSInvocation"))]
30 #[unsafe(method(scheduledTimerWithTimeInterval:invocation:repeats:))]
31 #[unsafe(method_family = none)]
32 pub unsafe fn scheduledTimerWithTimeInterval_invocation_repeats(
33 ti: NSTimeInterval,
34 invocation: &NSInvocation,
35 yes_or_no: bool,
36 ) -> Retained<NSTimer>;
37
38 #[cfg(feature = "NSDate")]
39 #[unsafe(method(timerWithTimeInterval:target:selector:userInfo:repeats:))]
40 #[unsafe(method_family = none)]
41 pub unsafe fn timerWithTimeInterval_target_selector_userInfo_repeats(
42 ti: NSTimeInterval,
43 a_target: &AnyObject,
44 a_selector: Sel,
45 user_info: Option<&AnyObject>,
46 yes_or_no: bool,
47 ) -> Retained<NSTimer>;
48
49 #[cfg(feature = "NSDate")]
50 #[unsafe(method(scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:))]
51 #[unsafe(method_family = none)]
52 pub unsafe fn scheduledTimerWithTimeInterval_target_selector_userInfo_repeats(
53 ti: NSTimeInterval,
54 a_target: &AnyObject,
55 a_selector: Sel,
56 user_info: Option<&AnyObject>,
57 yes_or_no: bool,
58 ) -> Retained<NSTimer>;
59
60 #[cfg(all(feature = "NSDate", feature = "block2"))]
61 #[unsafe(method(timerWithTimeInterval:repeats:block:))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn timerWithTimeInterval_repeats_block(
68 interval: NSTimeInterval,
69 repeats: bool,
70 block: &block2::Block<dyn Fn(NonNull<NSTimer>)>,
71 ) -> Retained<NSTimer>;
72
73 #[cfg(all(feature = "NSDate", feature = "block2"))]
74 #[unsafe(method(scheduledTimerWithTimeInterval:repeats:block:))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn scheduledTimerWithTimeInterval_repeats_block(
81 interval: NSTimeInterval,
82 repeats: bool,
83 block: &block2::Block<dyn Fn(NonNull<NSTimer>)>,
84 ) -> Retained<NSTimer>;
85
86 #[cfg(all(feature = "NSDate", feature = "block2"))]
87 #[unsafe(method(initWithFireDate:interval:repeats:block:))]
93 #[unsafe(method_family = init)]
94 pub unsafe fn initWithFireDate_interval_repeats_block(
95 this: Allocated<Self>,
96 date: &NSDate,
97 interval: NSTimeInterval,
98 repeats: bool,
99 block: &block2::Block<dyn Fn(NonNull<NSTimer>)>,
100 ) -> Retained<Self>;
101
102 #[cfg(feature = "NSDate")]
103 #[unsafe(method(initWithFireDate:interval:target:selector:userInfo:repeats:))]
104 #[unsafe(method_family = init)]
105 pub unsafe fn initWithFireDate_interval_target_selector_userInfo_repeats(
106 this: Allocated<Self>,
107 date: &NSDate,
108 ti: NSTimeInterval,
109 t: &AnyObject,
110 s: Sel,
111 ui: Option<&AnyObject>,
112 rep: bool,
113 ) -> Retained<Self>;
114
115 #[unsafe(method(fire))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn fire(&self);
118
119 #[cfg(feature = "NSDate")]
120 #[unsafe(method(fireDate))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn fireDate(&self) -> Retained<NSDate>;
123
124 #[cfg(feature = "NSDate")]
125 #[unsafe(method(setFireDate:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn setFireDate(&self, fire_date: &NSDate);
129
130 #[cfg(feature = "NSDate")]
131 #[unsafe(method(timeInterval))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn timeInterval(&self) -> NSTimeInterval;
134
135 #[cfg(feature = "NSDate")]
136 #[unsafe(method(tolerance))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn tolerance(&self) -> NSTimeInterval;
139
140 #[cfg(feature = "NSDate")]
141 #[unsafe(method(setTolerance:))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn setTolerance(&self, tolerance: NSTimeInterval);
145
146 #[unsafe(method(invalidate))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn invalidate(&self);
149
150 #[unsafe(method(isValid))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn isValid(&self) -> bool;
153
154 #[unsafe(method(userInfo))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn userInfo(&self) -> Option<Retained<AnyObject>>;
157 );
158}
159
160impl NSTimer {
162 extern_methods!(
163 #[unsafe(method(init))]
164 #[unsafe(method_family = init)]
165 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
166
167 #[unsafe(method(new))]
168 #[unsafe(method_family = new)]
169 pub unsafe fn new() -> Retained<Self>;
170 );
171}