objc2-ui-kit 0.3.2

Bindings to the UIKit framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilistcontentconfiguration?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIListContentConfiguration;
);

extern_conformance!(
    unsafe impl NSCoding for UIListContentConfiguration {}
);

extern_conformance!(
    unsafe impl NSCopying for UIListContentConfiguration {}
);

unsafe impl CopyingHelper for UIListContentConfiguration {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for UIListContentConfiguration {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for UIListContentConfiguration {}
);

#[cfg(feature = "UIContentConfiguration")]
extern_conformance!(
    unsafe impl UIContentConfiguration for UIListContentConfiguration {}
);

impl UIListContentConfiguration {
    extern_methods!(
        /// Returns the default configuration for a list cell.
        /// From iOS 18 onwards, the configuration will automatically adopt the appropriate style for a list when updating for a
        /// new configuration state, by reading the `listEnvironment` trait from the state's trait collection.
        /// Defaults to a cell in a plain-style list.
        #[unsafe(method(cellConfiguration))]
        #[unsafe(method_family = none)]
        pub fn cellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for a list cell with subtitle text.
        /// From iOS 18 onwards, the configuration will automatically adopt the appropriate style for a list when updating for a
        /// new configuration state, by reading the `listEnvironment` trait from the state's trait collection.
        /// Defaults to a subtitle cell in a plain-style list.
        #[unsafe(method(subtitleCellConfiguration))]
        #[unsafe(method_family = none)]
        pub fn subtitleCellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for a list cell with side-by-side value text.
        /// From iOS 18 onwards, the configuration will automatically adopt the appropriate style for a list when updating for a
        /// new configuration state, by reading the `listEnvironment` trait from the state's trait collection.
        /// Defaults to the appearance of a value cell in a plain-style list.
        #[unsafe(method(valueCellConfiguration))]
        #[unsafe(method_family = none)]
        pub fn valueCellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Represents a generic header configuration that automatically adopts the style of a containing list when updating for a
        /// new configuration state, by reading the `listEnvironment` trait from the state's trait collection.
        /// Defaults to the header configuration for a plain-style list.
        #[unsafe(method(headerConfiguration))]
        #[unsafe(method_family = none)]
        pub fn headerConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Represents a generic footer configuration that automatically adopts the style of a containing list when updating for a
        /// new configuration state, by reading the `listEnvironment` trait from the state's trait collection.
        /// Defaults to the footer configuration for a plain-style list.
        #[unsafe(method(footerConfiguration))]
        #[unsafe(method_family = none)]
        pub fn footerConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for a prominent inset grouped list header.
        #[unsafe(method(prominentInsetGroupedHeaderConfiguration))]
        #[unsafe(method_family = none)]
        pub fn prominentInsetGroupedHeaderConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for an extra prominent inset grouped list header.
        #[unsafe(method(extraProminentInsetGroupedHeaderConfiguration))]
        #[unsafe(method_family = none)]
        pub fn extraProminentInsetGroupedHeaderConfiguration(
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        /// Returns the default configuration for an accompanied sidebar list cell.
        #[unsafe(method(accompaniedSidebarCellConfiguration))]
        #[unsafe(method_family = none)]
        pub fn accompaniedSidebarCellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for an accompanied sidebar list cell with subtitle text.
        #[unsafe(method(accompaniedSidebarSubtitleCellConfiguration))]
        #[unsafe(method_family = none)]
        pub fn accompaniedSidebarSubtitleCellConfiguration(mtm: MainThreadMarker)
            -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "UIImage")]
        /// The image to display.
        #[unsafe(method(image))]
        #[unsafe(method_family = none)]
        pub fn image(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        /// Setter for [`image`][Self::image].
        #[unsafe(method(setImage:))]
        #[unsafe(method_family = none)]
        pub fn setImage(&self, image: Option<&UIImage>);

        #[cfg(feature = "UIListContentImageProperties")]
        /// Additional properties to configure the image.
        #[unsafe(method(imageProperties))]
        #[unsafe(method_family = none)]
        pub fn imageProperties(&self) -> Retained<UIListContentImageProperties>;

        /// The primary text.
        #[unsafe(method(text))]
        #[unsafe(method_family = none)]
        pub fn text(&self) -> Option<Retained<NSString>>;

        /// Setter for [`text`][Self::text].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setText:))]
        #[unsafe(method_family = none)]
        pub fn setText(&self, text: Option<&NSString>);

        /// An attributed variant of the primary text, which supersedes the `text` and some properties of the `textProperties` if set.
        #[unsafe(method(attributedText))]
        #[unsafe(method_family = none)]
        pub fn attributedText(&self) -> Option<Retained<NSAttributedString>>;

        /// Setter for [`attributedText`][Self::attributedText].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAttributedText:))]
        #[unsafe(method_family = none)]
        pub fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);

        #[cfg(feature = "UIListContentTextProperties")]
        /// Additional properties to configure the primary text.
        #[unsafe(method(textProperties))]
        #[unsafe(method_family = none)]
        pub fn textProperties(&self) -> Retained<UIListContentTextProperties>;

        /// The secondary text.
        #[unsafe(method(secondaryText))]
        #[unsafe(method_family = none)]
        pub fn secondaryText(&self) -> Option<Retained<NSString>>;

        /// Setter for [`secondaryText`][Self::secondaryText].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setSecondaryText:))]
        #[unsafe(method_family = none)]
        pub fn setSecondaryText(&self, secondary_text: Option<&NSString>);

        /// An attributed variant of the secondary text, which supersedes the `secondaryText` and some properties of the `secondaryTextProperties` if set.
        #[unsafe(method(secondaryAttributedText))]
        #[unsafe(method_family = none)]
        pub fn secondaryAttributedText(&self) -> Option<Retained<NSAttributedString>>;

        /// Setter for [`secondaryAttributedText`][Self::secondaryAttributedText].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setSecondaryAttributedText:))]
        #[unsafe(method_family = none)]
        pub fn setSecondaryAttributedText(
            &self,
            secondary_attributed_text: Option<&NSAttributedString>,
        );

        #[cfg(feature = "UIListContentTextProperties")]
        /// Additional properties to configure the secondary text.
        #[unsafe(method(secondaryTextProperties))]
        #[unsafe(method_family = none)]
        pub fn secondaryTextProperties(&self) -> Retained<UIListContentTextProperties>;

        #[cfg(feature = "UIGeometry")]
        /// Whether the content view will preserve inherited layout margins from its superview on the horizontal and/or vertical axes.
        #[unsafe(method(axesPreservingSuperviewLayoutMargins))]
        #[unsafe(method_family = none)]
        pub fn axesPreservingSuperviewLayoutMargins(&self) -> UIAxis;

        #[cfg(feature = "UIGeometry")]
        /// Setter for [`axesPreservingSuperviewLayoutMargins`][Self::axesPreservingSuperviewLayoutMargins].
        #[unsafe(method(setAxesPreservingSuperviewLayoutMargins:))]
        #[unsafe(method_family = none)]
        pub fn setAxesPreservingSuperviewLayoutMargins(
            &self,
            axes_preserving_superview_layout_margins: UIAxis,
        );

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// The margins for the content to the edges of the content view. (When preserving superview layout margins on one or both axes, these are just minimum margins, as inherited margins may be larger.)
        #[unsafe(method(directionalLayoutMargins))]
        #[unsafe(method_family = none)]
        pub fn directionalLayoutMargins(&self) -> NSDirectionalEdgeInsets;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Setter for [`directionalLayoutMargins`][Self::directionalLayoutMargins].
        #[unsafe(method(setDirectionalLayoutMargins:))]
        #[unsafe(method_family = none)]
        pub fn setDirectionalLayoutMargins(
            &self,
            directional_layout_margins: NSDirectionalEdgeInsets,
        );

        /// When YES, the text and secondary text will be positioned side-by-side if there is sufficient space. Otherwise, the text will be stacked in a vertical layout.
        #[unsafe(method(prefersSideBySideTextAndSecondaryText))]
        #[unsafe(method_family = none)]
        pub fn prefersSideBySideTextAndSecondaryText(&self) -> bool;

        /// Setter for [`prefersSideBySideTextAndSecondaryText`][Self::prefersSideBySideTextAndSecondaryText].
        #[unsafe(method(setPrefersSideBySideTextAndSecondaryText:))]
        #[unsafe(method_family = none)]
        pub fn setPrefersSideBySideTextAndSecondaryText(
            &self,
            prefers_side_by_side_text_and_secondary_text: bool,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// Padding between the image and text. Only applies when there is both an image and text.
        #[unsafe(method(imageToTextPadding))]
        #[unsafe(method_family = none)]
        pub fn imageToTextPadding(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`imageToTextPadding`][Self::imageToTextPadding].
        #[unsafe(method(setImageToTextPadding:))]
        #[unsafe(method_family = none)]
        pub fn setImageToTextPadding(&self, image_to_text_padding: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        /// Horizontal (minimum) padding between the text and secondary text. Only applies when there is both text and secondary text, and they are in a side-by-side layout.
        #[unsafe(method(textToSecondaryTextHorizontalPadding))]
        #[unsafe(method_family = none)]
        pub fn textToSecondaryTextHorizontalPadding(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`textToSecondaryTextHorizontalPadding`][Self::textToSecondaryTextHorizontalPadding].
        #[unsafe(method(setTextToSecondaryTextHorizontalPadding:))]
        #[unsafe(method_family = none)]
        pub fn setTextToSecondaryTextHorizontalPadding(
            &self,
            text_to_secondary_text_horizontal_padding: CGFloat,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// Vertical padding between the text and secondary text. Only applies when there is both text and secondary text, and they are in a stacked layout.
        #[unsafe(method(textToSecondaryTextVerticalPadding))]
        #[unsafe(method_family = none)]
        pub fn textToSecondaryTextVerticalPadding(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`textToSecondaryTextVerticalPadding`][Self::textToSecondaryTextVerticalPadding].
        #[unsafe(method(setTextToSecondaryTextVerticalPadding:))]
        #[unsafe(method_family = none)]
        pub fn setTextToSecondaryTextVerticalPadding(
            &self,
            text_to_secondary_text_vertical_padding: CGFloat,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// The alpha to apply to the entire content view. Defaults to 1.0.
        #[unsafe(method(alpha))]
        #[unsafe(method_family = none)]
        pub fn alpha(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`alpha`][Self::alpha].
        #[unsafe(method(setAlpha:))]
        #[unsafe(method_family = none)]
        pub fn setAlpha(&self, alpha: CGFloat);

        /// Returns the default configuration for a sidebar list cell.
        #[deprecated]
        #[unsafe(method(sidebarCellConfiguration))]
        #[unsafe(method_family = none)]
        pub fn sidebarCellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for a sidebar list cell with subtitle text.
        #[deprecated]
        #[unsafe(method(sidebarSubtitleCellConfiguration))]
        #[unsafe(method_family = none)]
        pub fn sidebarSubtitleCellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for a plain list header.
        #[deprecated]
        #[unsafe(method(plainHeaderConfiguration))]
        #[unsafe(method_family = none)]
        pub fn plainHeaderConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for a plain list footer.
        #[deprecated]
        #[unsafe(method(plainFooterConfiguration))]
        #[unsafe(method_family = none)]
        pub fn plainFooterConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for a grouped list header.
        #[deprecated]
        #[unsafe(method(groupedHeaderConfiguration))]
        #[unsafe(method_family = none)]
        pub fn groupedHeaderConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for a grouped list footer.
        #[deprecated]
        #[unsafe(method(groupedFooterConfiguration))]
        #[unsafe(method_family = none)]
        pub fn groupedFooterConfiguration(mtm: MainThreadMarker) -> Retained<Self>;

        /// Returns the default configuration for a sidebar list header.
        #[deprecated]
        #[unsafe(method(sidebarHeaderConfiguration))]
        #[unsafe(method_family = none)]
        pub fn sidebarHeaderConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilistcontentview?language=objc)
    #[unsafe(super(UIView, UIResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    pub struct UIListContentView;
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UIView",
    feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
    unsafe impl CALayerDelegate for UIListContentView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSCoding for UIListContentView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIListContentView {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearance for UIListContentView {}
);

#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UIListContentView {}
);

#[cfg(all(
    feature = "UIContentConfiguration",
    feature = "UIResponder",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UIContentView for UIListContentView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UICoordinateSpace for UIListContentView {}
);

#[cfg(all(
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UIDynamicItem for UIListContentView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UIListContentView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItem for UIListContentView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItemContainer for UIListContentView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for UIListContentView {}
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UITraitEnvironment for UIListContentView {}
);

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIListContentView {
    extern_methods!(
        #[unsafe(method(initWithConfiguration:))]
        #[unsafe(method_family = init)]
        pub fn initWithConfiguration(
            this: Allocated<Self>,
            configuration: &UIListContentConfiguration,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;

        #[unsafe(method(configuration))]
        #[unsafe(method_family = none)]
        pub fn configuration(&self) -> Retained<UIListContentConfiguration>;

        /// Setter for [`configuration`][Self::configuration].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setConfiguration:))]
        #[unsafe(method_family = none)]
        pub fn setConfiguration(&self, configuration: &UIListContentConfiguration);

        #[cfg(feature = "UILayoutGuide")]
        /// This guide reflects the positioning of the primary text rendered by this content view, if specified by the configuration.
        ///
        /// Returns nil if there is no primary text. If a new configuration is applied that does not contain primary text, then this layout
        /// guide is removed from the view, and any constraints associated with it will be deactivated.
        #[unsafe(method(textLayoutGuide))]
        #[unsafe(method_family = none)]
        pub fn textLayoutGuide(&self) -> Option<Retained<UILayoutGuide>>;

        #[cfg(feature = "UILayoutGuide")]
        /// This guide reflects the positioning of the secondary text rendered by this content view, if specified by the configuration.
        ///
        /// Returns nil if there is no secondary text. If a new configuration is applied that does not contain secondary text, then this layout
        /// guide is removed from the view, and any constraints associated with it will be deactivated.
        #[unsafe(method(secondaryTextLayoutGuide))]
        #[unsafe(method_family = none)]
        pub fn secondaryTextLayoutGuide(&self) -> Option<Retained<UILayoutGuide>>;

        #[cfg(feature = "UILayoutGuide")]
        /// This guide reflects the positioning of the image rendered by this content view, if specified by the configuration.
        ///
        /// Returns nil if there is no image. If a new configuration is applied that does contain an image, then this layout
        /// guide is removed from the view, and any constraints associated with it will be deactivated.
        #[unsafe(method(imageLayoutGuide))]
        #[unsafe(method_family = none)]
        pub fn imageLayoutGuide(&self) -> Option<Retained<UILayoutGuide>>;
    );
}