1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;
use crate::*;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpcontact?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPContact;
);
extern_conformance!(
unsafe impl NSCoding for CPContact {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPContact {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPContact {}
);
impl CPContact {
extern_methods!(
#[cfg(feature = "objc2-ui-kit")]
/// Initializes a new contact to be used with
/// `CPContactTemplate,`with a name and image
///
///
/// Parameter `name`: The name to be displayed for this contact.
///
/// Parameter `image`: An image for this contact. The maximum image size in points is CPButtonMaximumImageSize; larger images will be scaled down.
///
///
/// Note: When providing an image, your app should provide a
/// `UIImage`that is display-ready. If necessary for the image, provide
/// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
/// or by using
/// `UIImageAsset`to combine two
/// `UIImage`instances into a single image with
/// both styles.
///
/// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
///
///
/// To properly size your list images, your app should consider the display scale of the car screen.
/// See -[CPInterfaceController carTraitCollection].
#[unsafe(method(initWithName:image:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithName_image(
this: Allocated<Self>,
name: &NSString,
image: &UIImage,
) -> Retained<Self>;
/// The name that will be displayed for this contact.
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Retained<NSString>;
/// Setter for [`name`][Self::name].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setName:))]
#[unsafe(method_family = none)]
pub unsafe fn setName(&self, name: &NSString);
#[cfg(feature = "objc2-ui-kit")]
/// An image representing the contact.
#[unsafe(method(image))]
#[unsafe(method_family = none)]
pub unsafe fn image(&self) -> Retained<UIImage>;
#[cfg(feature = "objc2-ui-kit")]
/// Setter for [`image`][Self::image].
#[unsafe(method(setImage:))]
#[unsafe(method_family = none)]
pub unsafe fn setImage(&self, image: &UIImage);
#[cfg(feature = "CPButton")]
/// Action buttons that will be displayed when this
/// `CPContact`is displayed in a
/// `CPContactTemplate.`
#[unsafe(method(actions))]
#[unsafe(method_family = none)]
pub unsafe fn actions(&self) -> Option<Retained<NSArray<CPButton>>>;
#[cfg(feature = "CPButton")]
/// Setter for [`actions`][Self::actions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setActions:))]
#[unsafe(method_family = none)]
pub unsafe fn setActions(&self, actions: Option<&NSArray<CPButton>>);
/// Optional text that will be displayed in addition to the contact name
#[unsafe(method(subtitle))]
#[unsafe(method_family = none)]
pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;
/// Setter for [`subtitle`][Self::subtitle].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setSubtitle:))]
#[unsafe(method_family = none)]
pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);
/// Optional text that will be displayed in addition to the contact name
#[unsafe(method(informativeText))]
#[unsafe(method_family = none)]
pub unsafe fn informativeText(&self) -> Option<Retained<NSString>>;
/// Setter for [`informativeText`][Self::informativeText].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setInformativeText:))]
#[unsafe(method_family = none)]
pub unsafe fn setInformativeText(&self, informative_text: Option<&NSString>);
);
}
/// Methods declared on superclass `NSObject`.
impl CPContact {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpcontactcallbutton?language=objc)
#[unsafe(super(CPButton, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "CPButton")]
pub struct CPContactCallButton;
);
#[cfg(feature = "CPButton")]
extern_conformance!(
unsafe impl NSObjectProtocol for CPContactCallButton {}
);
#[cfg(feature = "CPButton")]
impl CPContactCallButton {
extern_methods!(
#[cfg(feature = "block2")]
/// Create a contact button with a system-provided call image that, when tapped, calls your custom handler.
///
///
/// Parameter `handler`: A block that will be called when the user taps this button.
#[unsafe(method(initWithHandler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithHandler(
this: Allocated<Self>,
handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
) -> Retained<Self>;
#[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
#[unsafe(method(initWithImage:handler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithImage_handler(
this: Allocated<Self>,
image: &UIImage,
handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `CPButton`.
#[cfg(feature = "CPButton")]
impl CPContactCallButton {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpcontactmessagebutton?language=objc)
#[unsafe(super(CPButton, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "CPButton")]
pub struct CPContactMessageButton;
);
#[cfg(feature = "CPButton")]
extern_conformance!(
unsafe impl NSObjectProtocol for CPContactMessageButton {}
);
#[cfg(feature = "CPButton")]
impl CPContactMessageButton {
extern_methods!(
/// Create a contact button that, when tapped, launches to Siri to compose a message to this entity.
/// When tapped, this button does NOT call a handler in your app. Instead, it will launch to Siri.
/// To compose a message, you must provide a phone OR email for this contact.
///
///
/// Parameter `phoneOrEmail`: A phone or email address for this contact. This will not be displayed in the button,
/// but it is necessary for Siri to compose a message to this contact entity.
#[unsafe(method(initWithPhoneOrEmail:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithPhoneOrEmail(
this: Allocated<Self>,
phone_or_email: &NSString,
) -> Retained<Self>;
#[unsafe(method(phoneOrEmail))]
#[unsafe(method_family = none)]
pub unsafe fn phoneOrEmail(&self) -> Retained<NSString>;
);
}
/// Methods declared on superclass `CPButton`.
#[cfg(feature = "CPButton")]
impl CPContactMessageButton {
extern_methods!(
#[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
/// Initialize a button for the Contact, POI, or Information templates with a custom image and a handler, called when
/// the user taps this button.
///
///
/// Parameter `image`: An image to be displayed in this button. The maximum image size is given by
/// `CPButtonMaximumImageSize.`
/// Parameter `handler`: A block that will be called when the user taps this button.
///
///
/// Note: This class is only available in templates that support buttons with custom images, like the Contact template.
///
///
/// When providing an image, your app should provide a
/// `UIImage`that is display-ready. If necessary for the image, provide
/// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
/// or by using
/// `UIImageAsset`to combine two
/// `UIImage`instances into a single image with
/// both styles.
///
/// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
#[unsafe(method(initWithImage:handler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithImage_handler(
this: Allocated<Self>,
image: &UIImage,
handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpcontactdirectionsbutton?language=objc)
#[unsafe(super(CPButton, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "CPButton")]
pub struct CPContactDirectionsButton;
);
#[cfg(feature = "CPButton")]
extern_conformance!(
unsafe impl NSObjectProtocol for CPContactDirectionsButton {}
);
#[cfg(feature = "CPButton")]
impl CPContactDirectionsButton {
extern_methods!(
#[cfg(feature = "block2")]
/// Create a contact button with a system-provided navigation directions image that, when tapped, calls your custom handler.
///
///
/// Parameter `handler`: A block that will be called when the user taps this button.
#[unsafe(method(initWithHandler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithHandler(
this: Allocated<Self>,
handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
) -> Retained<Self>;
#[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
#[unsafe(method(initWithImage:handler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithImage_handler(
this: Allocated<Self>,
image: &UIImage,
handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `CPButton`.
#[cfg(feature = "CPButton")]
impl CPContactDirectionsButton {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}