objc2_store_kit/generated/
SKProductDiscount.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/storekit/skproductdiscountpaymentmode?language=objc)
10// NS_ENUM
11#[deprecated = "Use Product.SubscriptionOffer.PaymentMode"]
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct SKProductDiscountPaymentMode(pub NSUInteger);
15impl SKProductDiscountPaymentMode {
16    #[doc(alias = "SKProductDiscountPaymentModePayAsYouGo")]
17    #[deprecated = "Use Product.SubscriptionOffer.PaymentMode"]
18    pub const PayAsYouGo: Self = Self(0);
19    #[doc(alias = "SKProductDiscountPaymentModePayUpFront")]
20    #[deprecated = "Use Product.SubscriptionOffer.PaymentMode"]
21    pub const PayUpFront: Self = Self(1);
22    #[doc(alias = "SKProductDiscountPaymentModeFreeTrial")]
23    #[deprecated = "Use Product.SubscriptionOffer.PaymentMode"]
24    pub const FreeTrial: Self = Self(2);
25}
26
27unsafe impl Encode for SKProductDiscountPaymentMode {
28    const ENCODING: Encoding = NSUInteger::ENCODING;
29}
30
31unsafe impl RefEncode for SKProductDiscountPaymentMode {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35/// [Apple's documentation](https://developer.apple.com/documentation/storekit/skproductdiscounttype?language=objc)
36// NS_ENUM
37#[deprecated = "Use Product.SubscriptionOffer.OfferType"]
38#[repr(transparent)]
39#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
40pub struct SKProductDiscountType(pub NSUInteger);
41impl SKProductDiscountType {
42    #[doc(alias = "SKProductDiscountTypeIntroductory")]
43    #[deprecated = "Use Product.SubscriptionOffer.OfferType"]
44    pub const Introductory: Self = Self(0);
45    #[doc(alias = "SKProductDiscountTypeSubscription")]
46    #[deprecated = "Use Product.SubscriptionOffer.OfferType"]
47    pub const Subscription: Self = Self(1);
48}
49
50unsafe impl Encode for SKProductDiscountType {
51    const ENCODING: Encoding = NSUInteger::ENCODING;
52}
53
54unsafe impl RefEncode for SKProductDiscountType {
55    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58extern_class!(
59    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skproductdiscount?language=objc)
60    #[unsafe(super(NSObject))]
61    #[derive(Debug, PartialEq, Eq, Hash)]
62    #[deprecated = "Use Product.SubscriptionOffer"]
63    pub struct SKProductDiscount;
64);
65
66unsafe impl Send for SKProductDiscount {}
67
68unsafe impl Sync for SKProductDiscount {}
69
70extern_conformance!(
71    unsafe impl NSObjectProtocol for SKProductDiscount {}
72);
73
74impl SKProductDiscount {
75    extern_methods!(
76        /// This property is not atomic.
77        ///
78        /// # Safety
79        ///
80        /// This might not be thread-safe.
81        #[deprecated = "Use Product.SubscriptionOffer.displayPrice"]
82        #[unsafe(method(price))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn price(&self) -> Retained<NSDecimalNumber>;
85
86        /// This property is not atomic.
87        ///
88        /// # Safety
89        ///
90        /// This might not be thread-safe.
91        #[deprecated = "Use Product.SubscriptionOffer.displayPrice"]
92        #[unsafe(method(priceLocale))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn priceLocale(&self) -> Retained<NSLocale>;
95
96        /// This property is not atomic.
97        ///
98        /// # Safety
99        ///
100        /// This might not be thread-safe.
101        #[deprecated = "Use Product.SubscriptionOffer.id"]
102        #[unsafe(method(identifier))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
105
106        #[cfg(feature = "SKProduct")]
107        /// This property is not atomic.
108        ///
109        /// # Safety
110        ///
111        /// This might not be thread-safe.
112        #[deprecated = "Use Product.SubscriptionOffer.period"]
113        #[unsafe(method(subscriptionPeriod))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn subscriptionPeriod(&self) -> Retained<SKProductSubscriptionPeriod>;
116
117        /// This property is not atomic.
118        ///
119        /// # Safety
120        ///
121        /// This might not be thread-safe.
122        #[deprecated = "Use Product.SubscriptionOffer.periodCount"]
123        #[unsafe(method(numberOfPeriods))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn numberOfPeriods(&self) -> NSUInteger;
126
127        /// This property is not atomic.
128        ///
129        /// # Safety
130        ///
131        /// This might not be thread-safe.
132        #[deprecated = "Use Product.SubscriptionOffer.paymentMode"]
133        #[unsafe(method(paymentMode))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn paymentMode(&self) -> SKProductDiscountPaymentMode;
136
137        /// This property is not atomic.
138        ///
139        /// # Safety
140        ///
141        /// This might not be thread-safe.
142        #[deprecated = "Use Product.SubscriptionOffer.type"]
143        #[unsafe(method(type))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn r#type(&self) -> SKProductDiscountType;
146    );
147}
148
149/// Methods declared on superclass `NSObject`.
150impl SKProductDiscount {
151    extern_methods!(
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new() -> Retained<Self>;
159    );
160}