objc2_ui_kit/generated/
UINotificationFeedbackGenerator.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8
9use crate::*;
10
11#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct UINotificationFeedbackType(pub NSInteger);
16impl UINotificationFeedbackType {
17 #[doc(alias = "UINotificationFeedbackTypeSuccess")]
18 pub const Success: Self = Self(0);
19 #[doc(alias = "UINotificationFeedbackTypeWarning")]
20 pub const Warning: Self = Self(1);
21 #[doc(alias = "UINotificationFeedbackTypeError")]
22 pub const Error: Self = Self(2);
23}
24
25unsafe impl Encode for UINotificationFeedbackType {
26 const ENCODING: Encoding = NSInteger::ENCODING;
27}
28
29unsafe impl RefEncode for UINotificationFeedbackType {
30 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
31}
32
33extern_class!(
34 #[unsafe(super(UIFeedbackGenerator, NSObject))]
36 #[thread_kind = MainThreadOnly]
37 #[derive(Debug, PartialEq, Eq, Hash)]
38 #[cfg(feature = "UIFeedbackGenerator")]
39 pub struct UINotificationFeedbackGenerator;
40);
41
42#[cfg(feature = "UIFeedbackGenerator")]
43extern_conformance!(
44 unsafe impl NSObjectProtocol for UINotificationFeedbackGenerator {}
45);
46
47#[cfg(feature = "UIFeedbackGenerator")]
48impl UINotificationFeedbackGenerator {
49 extern_methods!(
50 #[unsafe(method(notificationOccurred:))]
52 #[unsafe(method_family = none)]
53 pub fn notificationOccurred(&self, notification_type: UINotificationFeedbackType);
54
55 #[cfg(feature = "objc2-core-foundation")]
56 #[unsafe(method(notificationOccurred:atLocation:))]
57 #[unsafe(method_family = none)]
58 pub fn notificationOccurred_atLocation(
59 &self,
60 notification_type: UINotificationFeedbackType,
61 location: CGPoint,
62 );
63 );
64}
65
66#[cfg(feature = "UIFeedbackGenerator")]
68impl UINotificationFeedbackGenerator {
69 extern_methods!(
70 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
71 #[unsafe(method(feedbackGeneratorForView:))]
73 #[unsafe(method_family = none)]
74 pub fn feedbackGeneratorForView(view: &UIView) -> Retained<Self>;
75
76 #[deprecated]
77 #[unsafe(method(init))]
78 #[unsafe(method_family = init)]
79 pub fn init(this: Allocated<Self>) -> Retained<Self>;
80 );
81}
82
83#[cfg(feature = "UIFeedbackGenerator")]
85impl UINotificationFeedbackGenerator {
86 extern_methods!(
87 #[unsafe(method(new))]
88 #[unsafe(method_family = new)]
89 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
90 );
91}