objc2_ui_kit/generated/
UINotificationFeedbackGenerator.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinotificationfeedbacktype?language=objc)
12// NS_ENUM
13#[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinotificationfeedbackgenerator?language=objc)
35    #[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        /// call when a notification is displayed, passing the corresponding type
51        #[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/// Methods declared on superclass `UIFeedbackGenerator`.
67#[cfg(feature = "UIFeedbackGenerator")]
68impl UINotificationFeedbackGenerator {
69    extern_methods!(
70        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
71        /// initalize the generator with a view to attach it to the provided view as an interaction.
72        #[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/// Methods declared on superclass `NSObject`.
84#[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}