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")]
43unsafe impl NSObjectProtocol for UINotificationFeedbackGenerator {}
44
45#[cfg(feature = "UIFeedbackGenerator")]
46impl UINotificationFeedbackGenerator {
47 extern_methods!(
48 #[unsafe(method(notificationOccurred:))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn notificationOccurred(&self, notification_type: UINotificationFeedbackType);
52
53 #[cfg(feature = "objc2-core-foundation")]
54 #[unsafe(method(notificationOccurred:atLocation:))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn notificationOccurred_atLocation(
57 &self,
58 notification_type: UINotificationFeedbackType,
59 location: CGPoint,
60 );
61 );
62}
63
64#[cfg(feature = "UIFeedbackGenerator")]
66impl UINotificationFeedbackGenerator {
67 extern_methods!(
68 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
69 #[unsafe(method(feedbackGeneratorForView:))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn feedbackGeneratorForView(view: &UIView) -> Retained<Self>;
73
74 #[deprecated]
75 #[unsafe(method(init))]
76 #[unsafe(method_family = init)]
77 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
78 );
79}
80
81#[cfg(feature = "UIFeedbackGenerator")]
83impl UINotificationFeedbackGenerator {
84 extern_methods!(
85 #[unsafe(method(new))]
86 #[unsafe(method_family = new)]
87 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
88 );
89}