objc2_store_kit/generated/
SKProduct.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/skproductperiodunit?language=objc)
10// NS_ENUM
11#[deprecated = "Use Product.SubscriptionPeriod.Unit"]
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct SKProductPeriodUnit(pub NSUInteger);
15impl SKProductPeriodUnit {
16    #[doc(alias = "SKProductPeriodUnitDay")]
17    #[deprecated = "Use Product.SubscriptionPeriod.Unit"]
18    pub const Day: Self = Self(0);
19    #[doc(alias = "SKProductPeriodUnitWeek")]
20    #[deprecated = "Use Product.SubscriptionPeriod.Unit"]
21    pub const Week: Self = Self(1);
22    #[doc(alias = "SKProductPeriodUnitMonth")]
23    #[deprecated = "Use Product.SubscriptionPeriod.Unit"]
24    pub const Month: Self = Self(2);
25    #[doc(alias = "SKProductPeriodUnitYear")]
26    #[deprecated = "Use Product.SubscriptionPeriod.Unit"]
27    pub const Year: Self = Self(3);
28}
29
30unsafe impl Encode for SKProductPeriodUnit {
31    const ENCODING: Encoding = NSUInteger::ENCODING;
32}
33
34unsafe impl RefEncode for SKProductPeriodUnit {
35    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38extern_class!(
39    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skproductsubscriptionperiod?language=objc)
40    #[unsafe(super(NSObject))]
41    #[derive(Debug, PartialEq, Eq, Hash)]
42    #[deprecated = "Use Product.SubscriptionPeriod"]
43    pub struct SKProductSubscriptionPeriod;
44);
45
46unsafe impl Send for SKProductSubscriptionPeriod {}
47
48unsafe impl Sync for SKProductSubscriptionPeriod {}
49
50extern_conformance!(
51    unsafe impl NSObjectProtocol for SKProductSubscriptionPeriod {}
52);
53
54impl SKProductSubscriptionPeriod {
55    extern_methods!(
56        /// This property is not atomic.
57        ///
58        /// # Safety
59        ///
60        /// This might not be thread-safe.
61        #[deprecated = "Use Product.SubscriptionPeriod"]
62        #[unsafe(method(numberOfUnits))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn numberOfUnits(&self) -> NSUInteger;
65
66        /// This property is not atomic.
67        ///
68        /// # Safety
69        ///
70        /// This might not be thread-safe.
71        #[deprecated = "Use Product.SubscriptionPeriod"]
72        #[unsafe(method(unit))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn unit(&self) -> SKProductPeriodUnit;
75    );
76}
77
78/// Methods declared on superclass `NSObject`.
79impl SKProductSubscriptionPeriod {
80    extern_methods!(
81        #[unsafe(method(init))]
82        #[unsafe(method_family = init)]
83        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
84
85        #[unsafe(method(new))]
86        #[unsafe(method_family = new)]
87        pub unsafe fn new() -> Retained<Self>;
88    );
89}
90
91extern_class!(
92    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skproduct?language=objc)
93    #[unsafe(super(NSObject))]
94    #[derive(Debug, PartialEq, Eq, Hash)]
95    #[deprecated = "Use Product"]
96    pub struct SKProduct;
97);
98
99unsafe impl Send for SKProduct {}
100
101unsafe impl Sync for SKProduct {}
102
103extern_conformance!(
104    unsafe impl NSObjectProtocol for SKProduct {}
105);
106
107impl SKProduct {
108    extern_methods!(
109        /// This property is not atomic.
110        ///
111        /// # Safety
112        ///
113        /// This might not be thread-safe.
114        #[deprecated = "Use Product.description"]
115        #[unsafe(method(localizedDescription))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn localizedDescription(&self) -> Retained<NSString>;
118
119        /// This property is not atomic.
120        ///
121        /// # Safety
122        ///
123        /// This might not be thread-safe.
124        #[deprecated = "Use Product.displayName"]
125        #[unsafe(method(localizedTitle))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn localizedTitle(&self) -> Retained<NSString>;
128
129        /// This property is not atomic.
130        ///
131        /// # Safety
132        ///
133        /// This might not be thread-safe.
134        #[deprecated = "Use Product.displayPrice"]
135        #[unsafe(method(price))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn price(&self) -> Retained<NSDecimalNumber>;
138
139        /// This property is not atomic.
140        ///
141        /// # Safety
142        ///
143        /// This might not be thread-safe.
144        #[deprecated = "Use Product.displayPrice"]
145        #[unsafe(method(priceLocale))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn priceLocale(&self) -> Retained<NSLocale>;
148
149        /// This property is not atomic.
150        ///
151        /// # Safety
152        ///
153        /// This might not be thread-safe.
154        #[deprecated = "Use Product.id"]
155        #[unsafe(method(productIdentifier))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn productIdentifier(&self) -> Retained<NSString>;
158
159        /// This property is not atomic.
160        ///
161        /// # Safety
162        ///
163        /// This might not be thread-safe.
164        #[deprecated = "Hosted content is no longer supported"]
165        #[unsafe(method(isDownloadable))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn isDownloadable(&self) -> bool;
168
169        /// This property is not atomic.
170        ///
171        /// # Safety
172        ///
173        /// This might not be thread-safe.
174        #[deprecated]
175        #[unsafe(method(downloadable))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn downloadable(&self) -> bool;
178
179        /// This property is not atomic.
180        ///
181        /// # Safety
182        ///
183        /// This might not be thread-safe.
184        #[deprecated = "Use Product.isFamilyShareable"]
185        #[unsafe(method(isFamilyShareable))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn isFamilyShareable(&self) -> bool;
188
189        /// This property is not atomic.
190        ///
191        /// # Safety
192        ///
193        /// This might not be thread-safe.
194        #[deprecated]
195        #[unsafe(method(contentLengths))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn contentLengths(&self) -> Retained<NSArray<NSNumber>>;
198
199        /// This property is not atomic.
200        ///
201        /// # Safety
202        ///
203        /// This might not be thread-safe.
204        #[deprecated = "Hosted content is no longer supported"]
205        #[unsafe(method(downloadContentLengths))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn downloadContentLengths(&self) -> Retained<NSArray<NSNumber>>;
208
209        /// This property is not atomic.
210        ///
211        /// # Safety
212        ///
213        /// This might not be thread-safe.
214        #[deprecated]
215        #[unsafe(method(contentVersion))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn contentVersion(&self) -> Retained<NSString>;
218
219        /// This property is not atomic.
220        ///
221        /// # Safety
222        ///
223        /// This might not be thread-safe.
224        #[deprecated = "Hosted content is no longer supported"]
225        #[unsafe(method(downloadContentVersion))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn downloadContentVersion(&self) -> Retained<NSString>;
228
229        /// This property is not atomic.
230        ///
231        /// # Safety
232        ///
233        /// This might not be thread-safe.
234        #[deprecated = "Use Product.subscription.subscriptionPeriod"]
235        #[unsafe(method(subscriptionPeriod))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn subscriptionPeriod(&self) -> Option<Retained<SKProductSubscriptionPeriod>>;
238
239        #[cfg(feature = "SKProductDiscount")]
240        /// This property is not atomic.
241        ///
242        /// # Safety
243        ///
244        /// This might not be thread-safe.
245        #[deprecated = "Use Product.subscription.introductionaryOffer"]
246        #[unsafe(method(introductoryPrice))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn introductoryPrice(&self) -> Option<Retained<SKProductDiscount>>;
249
250        /// This property is not atomic.
251        ///
252        /// # Safety
253        ///
254        /// This might not be thread-safe.
255        #[deprecated = "Use Product.subscription.subscriptionGroupID"]
256        #[unsafe(method(subscriptionGroupIdentifier))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn subscriptionGroupIdentifier(&self) -> Option<Retained<NSString>>;
259
260        #[cfg(feature = "SKProductDiscount")]
261        /// This property is not atomic.
262        ///
263        /// # Safety
264        ///
265        /// This might not be thread-safe.
266        #[deprecated = "Use Product.subscription.promotionalOffers"]
267        #[unsafe(method(discounts))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn discounts(&self) -> Retained<NSArray<SKProductDiscount>>;
270    );
271}
272
273/// Methods declared on superclass `NSObject`.
274impl SKProduct {
275    extern_methods!(
276        #[unsafe(method(init))]
277        #[unsafe(method_family = init)]
278        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
279
280        #[unsafe(method(new))]
281        #[unsafe(method_family = new)]
282        pub unsafe fn new() -> Retained<Self>;
283    );
284}