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
//! 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!(
/// `CPVoiceControlState`encapsulates the title variants and image(s) for a single voice control
/// state, like listening, loading, or recognized.
///
/// Your app may initialize the voice control template with one or more states, and
/// you may call
/// `activateVoiceControlState:`to switch between states you've defined.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpvoicecontrolstate?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPVoiceControlState;
);
extern_conformance!(
unsafe impl NSCoding for CPVoiceControlState {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPVoiceControlState {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPVoiceControlState {}
);
impl CPVoiceControlState {
extern_methods!(
#[cfg(feature = "objc2-ui-kit")]
/// Initialize a voice control state with a title and image.
///
///
/// Parameter `identifier`: A custom identifier you can use to identify this voice control state. You'll also
/// switch to this state by specifying this identifier.
///
/// Parameter `titleVariants`: An array of title variants. The Voice Control template will select the longest
/// variant that fits your specified content.
///
/// Parameter `image`: An image to be animated while this template is visible. The system
/// enforces a minimum cycle duration of 0.3 seconds and a maximum cycle duration of 5 seconds.
/// Voice Control state images may be a maximum of 150 by 150 points.
///
/// Parameter `repeats`: For an animated image, YES if the animation should repeat indefinitely, NO
/// to run the animation only once.
#[unsafe(method(initWithIdentifier:titleVariants:image:repeats:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithIdentifier_titleVariants_image_repeats(
this: Allocated<Self>,
identifier: &NSString,
title_variants: Option<&NSArray<NSString>>,
image: Option<&UIImage>,
repeats: bool,
) -> Retained<Self>;
#[unsafe(method(titleVariants))]
#[unsafe(method_family = none)]
pub unsafe fn titleVariants(&self) -> Option<Retained<NSArray<NSString>>>;
#[cfg(feature = "objc2-ui-kit")]
#[unsafe(method(image))]
#[unsafe(method_family = none)]
pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub unsafe fn identifier(&self) -> Retained<NSString>;
#[unsafe(method(repeats))]
#[unsafe(method_family = none)]
pub unsafe fn repeats(&self) -> bool;
);
}
/// Methods declared on superclass `NSObject`.
impl CPVoiceControlState {
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/cpvoicecontroltemplate?language=objc)
#[unsafe(super(CPTemplate, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "CPTemplate")]
pub struct CPVoiceControlTemplate;
);
#[cfg(feature = "CPTemplate")]
extern_conformance!(
unsafe impl NSCoding for CPVoiceControlTemplate {}
);
#[cfg(feature = "CPTemplate")]
extern_conformance!(
unsafe impl NSObjectProtocol for CPVoiceControlTemplate {}
);
#[cfg(feature = "CPTemplate")]
extern_conformance!(
unsafe impl NSSecureCoding for CPVoiceControlTemplate {}
);
#[cfg(feature = "CPTemplate")]
impl CPVoiceControlTemplate {
extern_methods!(
/// Initialize a voice control template with a list of voice control states.
///
///
/// Parameter `voiceControlStates`: An array of voice control states for this template. Your app can switch between these states after the template is presented.
///
///
/// Note: By default, the Voice Control template will begin on the first state specified.
///
///
/// Warning: You may specify a maximum of 5 voice control states. If you specify more than 5, only the first 5 will be available.
#[unsafe(method(initWithVoiceControlStates:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithVoiceControlStates(
this: Allocated<Self>,
voice_control_states: &NSArray<CPVoiceControlState>,
) -> Retained<Self>;
#[unsafe(method(voiceControlStates))]
#[unsafe(method_family = none)]
pub unsafe fn voiceControlStates(&self) -> Retained<NSArray<CPVoiceControlState>>;
/// Switch the voice control template to the state corresponding with a particular identifier.
///
///
/// Parameter `identifier`: An identifier corresponding to one of the voice control states used to initialize this template.
///
///
/// Note: The Voice Control template applies a rate-limit for voice control states; the template will
/// ignore voice control state changes that occur too rapidly or frequently in a short period of time.
///
///
/// Warning: You must first present this voice control template through your
/// `CPInterfaceController`before
/// activating a voice control state, otherwise this method will have no effect.
/// When the Voice Control template is first presented, the first state you specify in
/// `initWithVoiceControlStates:`will be visible.
#[unsafe(method(activateVoiceControlStateWithIdentifier:))]
#[unsafe(method_family = none)]
pub unsafe fn activateVoiceControlStateWithIdentifier(&self, identifier: &NSString);
/// The currently-active voice control state identifier.
#[unsafe(method(activeStateIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn activeStateIdentifier(&self) -> Option<Retained<NSString>>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "CPTemplate")]
impl CPVoiceControlTemplate {
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>;
);
}