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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
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/cpnowplayingmode?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPNowPlayingMode;
);
extern_conformance!(
unsafe impl NSCoding for CPNowPlayingMode {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPNowPlayingMode {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPNowPlayingMode {}
);
impl CPNowPlayingMode {
extern_methods!(
/// The default now playing mode. While this mode is active,
/// your app will display now playing metadata as donated to
/// the shared system now playing info center.
#[unsafe(method(defaultNowPlayingMode))]
#[unsafe(method_family = none)]
pub unsafe fn defaultNowPlayingMode(mtm: MainThreadMarker) -> Retained<CPNowPlayingMode>;
);
}
/// Methods declared on superclass `NSObject`.
impl CPNowPlayingMode {
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(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_class!(
/// The sports mode represents a layout for now playing suited to live-streaming or
/// recorded playback of a sporting event that features exactly two teams.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingmodesports?language=objc)
#[unsafe(super(CPNowPlayingMode, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPNowPlayingModeSports;
);
extern_conformance!(
unsafe impl NSCoding for CPNowPlayingModeSports {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPNowPlayingModeSports {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPNowPlayingModeSports {}
);
impl CPNowPlayingModeSports {
extern_methods!(
#[cfg(feature = "objc2-ui-kit")]
/// Initialize a sports mode for display on the CarPlay now playing screen.
///
///
/// Parameter `leftTeam`: The sports team that should appear on the left side of the
/// now playing screen. This is commonly (but not always) the AWAY or VISITING team.
/// This team will be on the left in all layouts; it does not flip to the right
/// side when in a right-to-left language or a right-hand-drive vehicle.
///
///
/// Parameter `rightTeam`: The sports team that should appear on the right side of the
/// now playing screen. This is commonly (but not always) the HOME team.
/// This team will be on the right in all layouts; it does not flip to the left
/// side when in a right-to-left language or a right-hand-drive vehicle.
///
///
/// Parameter `eventStatus`: A representation of the current event status. See
/// `CPNowPlayingSportsEventStatus`for more information.
///
///
/// Parameter `backgroundArtwork`: A large colorful image for the background of the
/// now playing screen. A gradient or crossfade image works best, especially
/// when it includes the primary colors of each team. Provide an image no larger
/// than 500x500.
#[unsafe(method(initWithLeftTeam:rightTeam:eventStatus:backgroundArtwork:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithLeftTeam_rightTeam_eventStatus_backgroundArtwork(
this: Allocated<Self>,
left_team: &CPNowPlayingSportsTeam,
right_team: &CPNowPlayingSportsTeam,
event_status: Option<&CPNowPlayingSportsEventStatus>,
background_artwork: Option<&UIImage>,
) -> Retained<Self>;
/// The sports team that should appear on the left side of the
/// now playing screen. This is commonly (but not always) the AWAY or VISITING team.
/// This team will be on the left in all layouts; it does not flip to the right
/// side when in a right-to-left language or a right-hand-drive vehicle.
#[unsafe(method(leftTeam))]
#[unsafe(method_family = none)]
pub unsafe fn leftTeam(&self) -> Retained<CPNowPlayingSportsTeam>;
/// The sports team that should appear on the right side of the
/// now playing screen. This is commonly (but not always) the HOME team.
/// This team will be on the right in all layouts; it does not flip to the left
/// side when in a right-to-left language or a right-hand-drive vehicle.
#[unsafe(method(rightTeam))]
#[unsafe(method_family = none)]
pub unsafe fn rightTeam(&self) -> Retained<CPNowPlayingSportsTeam>;
/// A representation of the current event status. See
/// `CPNowPlayingSportsEventStatus`for more information.
#[unsafe(method(eventStatus))]
#[unsafe(method_family = none)]
pub unsafe fn eventStatus(&self) -> Option<Retained<CPNowPlayingSportsEventStatus>>;
#[cfg(feature = "objc2-ui-kit")]
/// A large colorful image for the background of the
/// now playing screen. A gradient or crossfade image works best, especially
/// when it includes the primary colors of each team. Provide an image no larger
/// than 500x500.
#[unsafe(method(backgroundArtwork))]
#[unsafe(method_family = none)]
pub unsafe fn backgroundArtwork(&self) -> Option<Retained<UIImage>>;
);
}
/// Methods declared on superclass `NSObject`.
impl CPNowPlayingModeSports {
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(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_class!(
/// A representation of a sports team for the now playing screen,
/// in sports that have exactly two teams.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingsportsteam?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPNowPlayingSportsTeam;
);
extern_conformance!(
unsafe impl NSCoding for CPNowPlayingSportsTeam {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPNowPlayingSportsTeam {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPNowPlayingSportsTeam {}
);
impl CPNowPlayingSportsTeam {
extern_methods!(
#[cfg(feature = "objc2-ui-kit")]
/// Initialize a sports team for display on the now playing screen.
///
///
/// Parameter `name`: A localized, user-visible name for this sports team.
///
/// Parameter `logo`: The team logo or, if no logo is available, the initials/abbreviation for this team.
///
/// Parameter `teamStandings`: An optional additional label displayed near the team name. This could be a
/// win-loss ratio string, team standings, or other statistics relevant to this team.
/// Depending on the size of the car screen, a maximum of 15-20 characters may
/// be displayed.
///
/// Parameter `eventScore`: The score string for this team in the current event. Depending on the size
/// of the car screen, a maximum of 3 to 5 characters may be displayed.
///
/// Parameter `possessionIndicator`: An optional indicator used to indicate possession by this team.
/// Only one team should have possession at a given time.
///
/// Parameter `favorite`: If true, the team is marked with a star to indicate it has been saved as a
/// user favorite.
#[unsafe(method(initWithName:logo:teamStandings:eventScore:possessionIndicator:favorite:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithName_logo_teamStandings_eventScore_possessionIndicator_favorite(
this: Allocated<Self>,
name: &NSString,
logo: &CPNowPlayingSportsTeamLogo,
team_standings: Option<&NSString>,
event_score: &NSString,
possession_indicator: Option<&UIImage>,
favorite: bool,
) -> Retained<Self>;
/// A localized, user-visible name for this sports team.
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Retained<NSString>;
/// The team logo or, if no logo is available, the initials/abbreviation for this team.
/// See
/// `CPNowPlayingSportsTeamLogo.`
#[unsafe(method(logo))]
#[unsafe(method_family = none)]
pub unsafe fn logo(&self) -> Retained<CPNowPlayingSportsTeamLogo>;
/// An optional additional label displayed near the team name. This could be a
/// win-loss ratio string, team standings, or other statistics relevant to this team.
/// Depending on the size of the car screen, a maximum of 15-20 characters may
/// be displayed.
#[unsafe(method(teamStandings))]
#[unsafe(method_family = none)]
pub unsafe fn teamStandings(&self) -> Option<Retained<NSString>>;
/// The numeric score string for this team in the current event. Depending on the size
/// of the car screen, a maximum of 3 to 5 characters may be displayed.
#[unsafe(method(eventScore))]
#[unsafe(method_family = none)]
pub unsafe fn eventScore(&self) -> Retained<NSString>;
#[cfg(feature = "objc2-ui-kit")]
/// An optional indicator used to indicate possession by this team.
/// Only one team should have possession at a given time.
#[unsafe(method(possessionIndicator))]
#[unsafe(method_family = none)]
pub unsafe fn possessionIndicator(&self) -> Option<Retained<UIImage>>;
/// If true, the team is marked with a star to indicate it has been saved as a
/// user favorite.
#[unsafe(method(isFavorite))]
#[unsafe(method_family = none)]
pub unsafe fn isFavorite(&self) -> bool;
#[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(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_class!(
/// A representation of the status of a sporting event.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingsportseventstatus?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPNowPlayingSportsEventStatus;
);
extern_conformance!(
unsafe impl NSCoding for CPNowPlayingSportsEventStatus {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPNowPlayingSportsEventStatus {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPNowPlayingSportsEventStatus {}
);
impl CPNowPlayingSportsEventStatus {
extern_methods!(
#[cfg(feature = "objc2-ui-kit")]
/// Initialize an event status with optional event status text, an optional event status image,
/// and an optional event clock.
///
///
/// Parameter `eventStatusText`: Up to three separate strings for event status may be displayed.
///
/// The first string should always be used to show the play period (quarter, inning, period)
/// using as few characters as possible; e.g. "2nd" for the 2nd quarter.
///
/// The second and third strings can be used to display additional information, like "1st & 10" and "SF 15"
/// for an American football game.
///
/// All three strings should be kept as brief as possible to ensure they display well on car screens
/// of various sizes.
///
/// Parameter `eventStatusImage`: An optional event status image for this event, if it applies to this event. For example,
/// a baseball game could display a representation of the bases and outs, indicating
/// how many bases are loaded and the number of outs in the current inning.
///
/// Parameter `eventClock`: The event timer, if it applies to this event. See
/// `CPNowPlayingSportsClock.`
#[unsafe(method(initWithEventStatusText:eventStatusImage:eventClock:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithEventStatusText_eventStatusImage_eventClock(
this: Allocated<Self>,
event_status_text: Option<&NSArray<NSString>>,
event_status_image: Option<&UIImage>,
event_clock: Option<&CPNowPlayingSportsClock>,
) -> Retained<Self>;
/// Up to three separate strings for event status may be displayed.
///
/// The first string should always be used to show the play period (quarter, inning, period)
/// using as few characters as possible; e.g. "2nd" for the 2nd quarter.
///
/// The second and third strings can be used to display additional information, like "1st & 10" and "SF 15"
/// for an American football game.
///
/// All three strings should be kept as brief as possible to ensure they display well on car screens
/// of various sizes.
#[unsafe(method(eventStatusText))]
#[unsafe(method_family = none)]
pub unsafe fn eventStatusText(&self) -> Option<Retained<NSArray<NSString>>>;
/// The event timer, if it applies to this event. See
/// `CPNowPlayingSportsClock.`
#[unsafe(method(eventClock))]
#[unsafe(method_family = none)]
pub unsafe fn eventClock(&self) -> Option<Retained<CPNowPlayingSportsClock>>;
#[cfg(feature = "objc2-ui-kit")]
/// An optional event status image for this event, if it applies to this event. For example,
/// a baseball game could display a representation of the bases and outs, indicating
/// how many bases are loaded and the number of outs in the current inning.
#[unsafe(method(eventStatusImage))]
#[unsafe(method_family = none)]
pub unsafe fn eventStatusImage(&self) -> Option<Retained<UIImage>>;
#[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(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_class!(
/// A representation of the amount of time elapsed so far in this event,
/// for events where the clock counts UP.
///
/// Or, a representation of the amount of time remaining in the event,
/// or a section of the event (period/quarter/etc.) for events where the
/// clock counts DOWN.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingsportsclock?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPNowPlayingSportsClock;
);
extern_conformance!(
unsafe impl NSCoding for CPNowPlayingSportsClock {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPNowPlayingSportsClock {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPNowPlayingSportsClock {}
);
impl CPNowPlayingSportsClock {
extern_methods!(
/// Represents a duration of time that has elapsed so far in this event, or play period of the event (quarter/inning/period).
///
/// When displayed on the now playing screen, the clock will count UP.
#[unsafe(method(initWithElapsedTime:paused:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithElapsedTime_paused(
this: Allocated<Self>,
elapsed_time: NSTimeInterval,
paused: bool,
) -> Retained<Self>;
/// Represents an amount of time remaining in the event, or play period of the event (quarter/inning/period).
///
/// When displayed on the now playing screen, the clock will count DOWN.
#[unsafe(method(initWithTimeRemaining:paused:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTimeRemaining_paused(
this: Allocated<Self>,
time_remaining: NSTimeInterval,
paused: bool,
) -> Retained<Self>;
/// The time value in the clock; either elapsed time or time remaining.
#[unsafe(method(timeValue))]
#[unsafe(method_family = none)]
pub unsafe fn timeValue(&self) -> NSTimeInterval;
/// Whether the clock should be paused, e.g. due to a stoppage in play.
///
/// If YES, the clock will be paused at the specified value.
///
/// If NO, the clock will count up (or down).
#[unsafe(method(isPaused))]
#[unsafe(method_family = none)]
pub unsafe fn isPaused(&self) -> bool;
/// If true, the timer is counting UP, so as to indicate an amount of time elapsed
/// so far in this event.
///
/// If false, the timer is counting DOWN, so as to indicate an amount of time
/// remaining in the event, or a play period of the event (quarter/inning/period).
#[unsafe(method(countsUp))]
#[unsafe(method_family = none)]
pub unsafe fn countsUp(&self) -> bool;
#[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(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_class!(
/// A logo image or, if no image is available, an abbreviation
/// or initialism for this team.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingsportsteamlogo?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPNowPlayingSportsTeamLogo;
);
extern_conformance!(
unsafe impl NSCoding for CPNowPlayingSportsTeamLogo {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPNowPlayingSportsTeamLogo {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPNowPlayingSportsTeamLogo {}
);
impl CPNowPlayingSportsTeamLogo {
extern_methods!(
#[cfg(feature = "objc2-ui-kit")]
/// Initialize a team logo with an image representation of this team.
/// Provide an image no larger than 350x350; larger images will be resized down.
#[unsafe(method(initWithTeamLogo:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTeamLogo(
this: Allocated<Self>,
team_logo: &UIImage,
) -> Retained<Self>;
/// If no team logo image is available, initialize a team logo
/// with an abbreviation or initialism for this team.
///
/// A maximum of 3 characters may be displayed for the team initials.
#[unsafe(method(initWithTeamInitials:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTeamInitials(
this: Allocated<Self>,
team_initials: &NSString,
) -> Retained<Self>;
#[cfg(feature = "objc2-ui-kit")]
/// A team logo image for this team.
#[unsafe(method(logo))]
#[unsafe(method_family = none)]
pub unsafe fn logo(&self) -> Option<Retained<UIImage>>;
/// An abbreviation or initialism for this team, used only if
/// no logo image is available for this team.
#[unsafe(method(initials))]
#[unsafe(method_family = none)]
pub unsafe fn initials(&self) -> Option<Retained<NSString>>;
#[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(mtm: MainThreadMarker) -> Retained<Self>;
);
}