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
//! 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::*;
use crate::*;
/// The role of the relevant shortcut.
///
/// Provides a hint to Siri about the expected user experience.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/intents/inrelevantshortcutrole?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct INRelevantShortcutRole(pub NSInteger);
impl INRelevantShortcutRole {
/// The relevant shortcut represents an action that the user may want to perform using your app.
#[doc(alias = "INRelevantShortcutRoleAction")]
pub const Action: Self = Self(0);
/// The relevant shortcut represents information that the user may want to glance at.
#[doc(alias = "INRelevantShortcutRoleInformation")]
pub const Information: Self = Self(1);
}
unsafe impl Encode for INRelevantShortcutRole {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for INRelevantShortcutRole {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// Lets you provide relevant shortcut to Siri, for display on the Siri Watch Face.
///
/// Including relevance information allows Siri to make suggestions for shortcuts that the user might be interested in but has not previously performed.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/intents/inrelevantshortcut?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct INRelevantShortcut;
);
extern_conformance!(
unsafe impl NSCoding for INRelevantShortcut {}
);
extern_conformance!(
unsafe impl NSCopying for INRelevantShortcut {}
);
unsafe impl CopyingHelper for INRelevantShortcut {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for INRelevantShortcut {}
);
extern_conformance!(
unsafe impl NSSecureCoding for INRelevantShortcut {}
);
impl INRelevantShortcut {
extern_methods!(
#[cfg(feature = "INRelevanceProvider")]
/// A collection of relevance information that is attached to the relevant shortcuts.
///
/// Providing additional relevance information allows Siri to suggest a shortcut that the user is interested in but has not previously performed.
///
/// See also: INRelevanceProvider
#[unsafe(method(relevanceProviders))]
#[unsafe(method_family = none)]
pub unsafe fn relevanceProviders(&self) -> Retained<NSArray<INRelevanceProvider>>;
#[cfg(feature = "INRelevanceProvider")]
/// Setter for [`relevanceProviders`][Self::relevanceProviders].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setRelevanceProviders:))]
#[unsafe(method_family = none)]
pub unsafe fn setRelevanceProviders(
&self,
relevance_providers: &NSArray<INRelevanceProvider>,
);
#[cfg(feature = "INDefaultCardTemplate")]
/// Customizes the display of the relevant shortcut on the Siri watch face.
///
/// By default, the UI for the relevant shortcut can be derivied from the information provided in the
/// `INShortcut.`In certain situations, it may be desirable to override this behavior and provide a custom template.
///
/// See also: INDefaultCardTemplate
#[unsafe(method(watchTemplate))]
#[unsafe(method_family = none)]
pub unsafe fn watchTemplate(&self) -> Option<Retained<INDefaultCardTemplate>>;
#[cfg(feature = "INDefaultCardTemplate")]
/// Setter for [`watchTemplate`][Self::watchTemplate].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setWatchTemplate:))]
#[unsafe(method_family = none)]
pub unsafe fn setWatchTemplate(&self, watch_template: Option<&INDefaultCardTemplate>);
/// Links the relevant shortcut to a specific WidgetKit widget kind.
///
/// When a relevant shortcut is linked to a WidgetKit widget, it hints to the system when to show the widget in a stack.
#[unsafe(method(widgetKind))]
#[unsafe(method_family = none)]
pub unsafe fn widgetKind(&self) -> Option<Retained<NSString>>;
/// Setter for [`widgetKind`][Self::widgetKind].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setWidgetKind:))]
#[unsafe(method_family = none)]
pub unsafe fn setWidgetKind(&self, widget_kind: Option<&NSString>);
/// The role of the relevant shortcut.
///
/// Provides a hint to Siri about the expected user experience. The default is
/// `INRelevantShortcutRoleAction.`
/// See also: INRelevantShortcutRole
#[unsafe(method(shortcutRole))]
#[unsafe(method_family = none)]
pub unsafe fn shortcutRole(&self) -> INRelevantShortcutRole;
/// Setter for [`shortcutRole`][Self::shortcutRole].
#[unsafe(method(setShortcutRole:))]
#[unsafe(method_family = none)]
pub unsafe fn setShortcutRole(&self, shortcut_role: INRelevantShortcutRole);
#[cfg(feature = "INShortcut")]
/// The shortcut that will be performed when this relevant shortcut is invoked.
///
/// See also: INShortcut
#[unsafe(method(shortcut))]
#[unsafe(method_family = none)]
pub unsafe fn shortcut(&self) -> Retained<INShortcut>;
#[cfg(feature = "INShortcut")]
/// Creates a relevant shortcut for the given shortcut.
#[unsafe(method(initWithShortcut:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithShortcut(
this: Allocated<Self>,
shortcut: &INShortcut,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl INRelevantShortcut {
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>;
);
}