objc2_ui_kit/generated/
NSDataAsset.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/uikit/nsdataassetname?language=objc)
10pub type NSDataAssetName = NSString;
11
12extern_class!(
13    /// NSDataAsset represents the contents of data entries in your asset catalog.
14    /// Data assets are not in the same class of stored content as images, so you cannot use a data asset to get image data for an image.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/nsdataasset?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct NSDataAsset;
20);
21
22unsafe impl Send for NSDataAsset {}
23
24unsafe impl Sync for NSDataAsset {}
25
26extern_conformance!(
27    unsafe impl NSCopying for NSDataAsset {}
28);
29
30unsafe impl CopyingHelper for NSDataAsset {
31    type Result = Self;
32}
33
34extern_conformance!(
35    unsafe impl NSObjectProtocol for NSDataAsset {}
36);
37
38impl NSDataAsset {
39    extern_methods!(
40        #[unsafe(method(init))]
41        #[unsafe(method_family = init)]
42        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
43
44        /// Equivalent to -initWithName:name bundle:[NSBundle mainBundle];
45        #[unsafe(method(initWithName:))]
46        #[unsafe(method_family = init)]
47        pub unsafe fn initWithName(
48            this: Allocated<Self>,
49            name: &NSDataAssetName,
50        ) -> Option<Retained<Self>>;
51
52        /// Create a data asset with the given name from the given bundle. Returns nil if the asset was not found.
53        #[unsafe(method(initWithName:bundle:))]
54        #[unsafe(method_family = init)]
55        pub unsafe fn initWithName_bundle(
56            this: Allocated<Self>,
57            name: &NSDataAssetName,
58            bundle: &NSBundle,
59        ) -> Option<Retained<Self>>;
60
61        /// The name used to reference the data asset
62        #[unsafe(method(name))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn name(&self) -> Retained<NSDataAssetName>;
65
66        /// The data for this asset, as stored in the asset catalog
67        #[unsafe(method(data))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn data(&self) -> Retained<NSData>;
70
71        /// The Uniform Type Identifier for this data object.
72        #[unsafe(method(typeIdentifier))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn typeIdentifier(&self) -> Retained<NSString>;
75    );
76}
77
78/// Methods declared on superclass `NSObject`.
79impl NSDataAsset {
80    extern_methods!(
81        #[unsafe(method(new))]
82        #[unsafe(method_family = new)]
83        pub unsafe fn new() -> Retained<Self>;
84    );
85}