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
16extern_conformance!(
17 unsafe impl NSObjectProtocol for NSTimer {}
18);
19
20impl NSTimer {
21 extern_methods!(
22 #[cfg(all(feature = "NSDate", feature = "NSInvocation"))]
23 #[unsafe(method(timerWithTimeInterval:invocation:repeats:))]
24 #[unsafe(method_family = none)]
25 pub unsafe fn timerWithTimeInterval_invocation_repeats(
26 ti: NSTimeInterval,
27 invocation: &NSInvocation,
28 yes_or_no: bool,
29 ) -> Retained<NSTimer>;
30
31 #[cfg(all(feature = "NSDate", feature = "NSInvocation"))]
32 #[unsafe(method(scheduledTimerWithTimeInterval:invocation:repeats:))]
33 #[unsafe(method_family = none)]
34 pub unsafe fn scheduledTimerWithTimeInterval_invocation_repeats(
35 ti: NSTimeInterval,
36 invocation: &NSInvocation,
37 yes_or_no: bool,
38 ) -> Retained<NSTimer>;
39
40 #[cfg(feature = "NSDate")]
41 #[unsafe(method(timerWithTimeInterval:target:selector:userInfo:repeats:))]
42 #[unsafe(method_family = none)]
43 pub unsafe fn timerWithTimeInterval_target_selector_userInfo_repeats(
44 ti: NSTimeInterval,
45 a_target: &AnyObject,
46 a_selector: Sel,
47 user_info: Option<&AnyObject>,
48 yes_or_no: bool,
49 ) -> Retained<NSTimer>;
50
51 #[cfg(feature = "NSDate")]
52 #[unsafe(method(scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn scheduledTimerWithTimeInterval_target_selector_userInfo_repeats(
55 ti: NSTimeInterval,
56 a_target: &AnyObject,
57 a_selector: Sel,
58 user_info: Option<&AnyObject>,
59 yes_or_no: bool,
60 ) -> Retained<NSTimer>;
61
62 #[cfg(all(feature = "NSDate", feature = "block2"))]
63 #[unsafe(method(timerWithTimeInterval:repeats:block:))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn timerWithTimeInterval_repeats_block(
70 interval: NSTimeInterval,
71 repeats: bool,
72 block: &block2::DynBlock<dyn Fn(NonNull<NSTimer>)>,
73 ) -> Retained<NSTimer>;
74
75 #[cfg(all(feature = "NSDate", feature = "block2"))]
76 #[unsafe(method(scheduledTimerWithTimeInterval:repeats:block:))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn scheduledTimerWithTimeInterval_repeats_block(
83 interval: NSTimeInterval,
84 repeats: bool,
85 block: &block2::DynBlock<dyn Fn(NonNull<NSTimer>)>,
86 ) -> Retained<NSTimer>;
87
88 #[cfg(all(feature = "NSDate", feature = "block2"))]
89 #[unsafe(method(initWithFireDate:interval:repeats:block:))]
95 #[unsafe(method_family = init)]
96 pub unsafe fn initWithFireDate_interval_repeats_block(
97 this: Allocated<Self>,
98 date: &NSDate,
99 interval: NSTimeInterval,
100 repeats: bool,
101 block: &block2::DynBlock<dyn Fn(NonNull<NSTimer>)>,
102 ) -> Retained<Self>;
103
104 #[cfg(feature = "NSDate")]
105 #[unsafe(method(initWithFireDate:interval:target:selector:userInfo:repeats:))]
106 #[unsafe(method_family = init)]
107 pub unsafe fn initWithFireDate_interval_target_selector_userInfo_repeats(
108 this: Allocated<Self>,
109 date: &NSDate,
110 ti: NSTimeInterval,
111 t: &AnyObject,
112 s: Sel,
113 ui: Option<&AnyObject>,
114 rep: bool,
115 ) -> Retained<Self>;
116
117 #[unsafe(method(fire))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn fire(&self);
120
121 #[cfg(feature = "NSDate")]
122 #[unsafe(method(fireDate))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn fireDate(&self) -> Retained<NSDate>;
125
126 #[cfg(feature = "NSDate")]
127 #[unsafe(method(setFireDate:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn setFireDate(&self, fire_date: &NSDate);
131
132 #[cfg(feature = "NSDate")]
133 #[unsafe(method(timeInterval))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn timeInterval(&self) -> NSTimeInterval;
136
137 #[cfg(feature = "NSDate")]
138 #[unsafe(method(tolerance))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn tolerance(&self) -> NSTimeInterval;
141
142 #[cfg(feature = "NSDate")]
143 #[unsafe(method(setTolerance:))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn setTolerance(&self, tolerance: NSTimeInterval);
147
148 #[unsafe(method(invalidate))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn invalidate(&self);
151
152 #[unsafe(method(isValid))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn isValid(&self) -> bool;
155
156 #[unsafe(method(userInfo))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn userInfo(&self) -> Option<Retained<AnyObject>>;
159 );
160}
161
162impl NSTimer {
164 extern_methods!(
165 #[unsafe(method(init))]
166 #[unsafe(method_family = init)]
167 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
168
169 #[unsafe(method(new))]
170 #[unsafe(method_family = new)]
171 pub unsafe fn new() -> Retained<Self>;
172 );
173}