use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UICollectionViewScrollPosition(pub NSUInteger);
bitflags::bitflags! {
impl UICollectionViewScrollPosition: NSUInteger {
#[doc(alias = "UICollectionViewScrollPositionNone")]
const None = 0;
#[doc(alias = "UICollectionViewScrollPositionTop")]
const Top = 1<<0;
#[doc(alias = "UICollectionViewScrollPositionCenteredVertically")]
const CenteredVertically = 1<<1;
#[doc(alias = "UICollectionViewScrollPositionBottom")]
const Bottom = 1<<2;
#[doc(alias = "UICollectionViewScrollPositionLeft")]
const Left = 1<<3;
#[doc(alias = "UICollectionViewScrollPositionCenteredHorizontally")]
const CenteredHorizontally = 1<<4;
#[doc(alias = "UICollectionViewScrollPositionRight")]
const Right = 1<<5;
}
}
unsafe impl Encode for UICollectionViewScrollPosition {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for UICollectionViewScrollPosition {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UICollectionViewReorderingCadence(pub NSInteger);
impl UICollectionViewReorderingCadence {
#[doc(alias = "UICollectionViewReorderingCadenceImmediate")]
pub const Immediate: Self = Self(0);
#[doc(alias = "UICollectionViewReorderingCadenceFast")]
pub const Fast: Self = Self(1);
#[doc(alias = "UICollectionViewReorderingCadenceSlow")]
pub const Slow: Self = Self(2);
}
unsafe impl Encode for UICollectionViewReorderingCadence {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UICollectionViewReorderingCadence {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UICollectionViewSelfSizingInvalidation(pub NSInteger);
impl UICollectionViewSelfSizingInvalidation {
#[doc(alias = "UICollectionViewSelfSizingInvalidationDisabled")]
pub const Disabled: Self = Self(0);
#[doc(alias = "UICollectionViewSelfSizingInvalidationEnabled")]
pub const Enabled: Self = Self(1);
#[doc(alias = "UICollectionViewSelfSizingInvalidationEnabledIncludingConstraints")]
pub const EnabledIncludingConstraints: Self = Self(2);
}
unsafe impl Encode for UICollectionViewSelfSizingInvalidation {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UICollectionViewSelfSizingInvalidation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "block2")]
pub type UICollectionViewLayoutInteractiveTransitionCompletion =
*mut block2::Block<dyn Fn(Bool, Bool)>;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIFocus")]
pub struct UICollectionViewFocusUpdateContext;
#[cfg(feature = "UIFocus")]
unsafe impl ClassType for UICollectionViewFocusUpdateContext {
#[inherits(NSObject)]
type Super = UIFocusUpdateContext;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "UIFocus")]
unsafe impl NSObjectProtocol for UICollectionViewFocusUpdateContext {}
extern_methods!(
#[cfg(feature = "UIFocus")]
unsafe impl UICollectionViewFocusUpdateContext {
#[method_id(@__retain_semantics Other previouslyFocusedIndexPath)]
pub unsafe fn previouslyFocusedIndexPath(&self) -> Option<Retained<NSIndexPath>>;
#[method_id(@__retain_semantics Other nextFocusedIndexPath)]
pub unsafe fn nextFocusedIndexPath(&self) -> Option<Retained<NSIndexPath>>;
}
);
extern_methods!(
#[cfg(feature = "UIFocus")]
unsafe impl UICollectionViewFocusUpdateContext {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait UICollectionViewDataSource:
NSObjectProtocol + IsMainThreadOnly
{
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
#[method(collectionView:numberOfItemsInSection:)]
unsafe fn collectionView_numberOfItemsInSection(
&self,
collection_view: &UICollectionView,
section: NSInteger,
) -> NSInteger;
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[method_id(@__retain_semantics Other collectionView:cellForItemAtIndexPath:)]
unsafe fn collectionView_cellForItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> Retained<UICollectionViewCell>;
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
#[optional]
#[method(numberOfSectionsInCollectionView:)]
unsafe fn numberOfSectionsInCollectionView(
&self,
collection_view: &UICollectionView,
) -> NSInteger;
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:viewForSupplementaryElementOfKind:atIndexPath:)]
unsafe fn collectionView_viewForSupplementaryElementOfKind_atIndexPath(
&self,
collection_view: &UICollectionView,
kind: &NSString,
index_path: &NSIndexPath,
) -> Retained<UICollectionReusableView>;
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
#[optional]
#[method(collectionView:canMoveItemAtIndexPath:)]
unsafe fn collectionView_canMoveItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
#[optional]
#[method(collectionView:moveItemAtIndexPath:toIndexPath:)]
unsafe fn collectionView_moveItemAtIndexPath_toIndexPath(
&self,
collection_view: &UICollectionView,
source_index_path: &NSIndexPath,
destination_index_path: &NSIndexPath,
);
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
#[optional]
#[method_id(@__retain_semantics Other indexTitlesForCollectionView:)]
unsafe fn indexTitlesForCollectionView(
&self,
collection_view: &UICollectionView,
) -> Option<Retained<NSArray<NSString>>>;
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:indexPathForIndexTitle:atIndex:)]
unsafe fn collectionView_indexPathForIndexTitle_atIndex(
&self,
collection_view: &UICollectionView,
title: &NSString,
index: NSInteger,
) -> Retained<NSIndexPath>;
}
unsafe impl ProtocolType for dyn UICollectionViewDataSource {}
);
extern_protocol!(
pub unsafe trait UICollectionViewDataSourcePrefetching:
NSObjectProtocol + IsMainThreadOnly
{
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
#[method(collectionView:prefetchItemsAtIndexPaths:)]
unsafe fn collectionView_prefetchItemsAtIndexPaths(
&self,
collection_view: &UICollectionView,
index_paths: &NSArray<NSIndexPath>,
);
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
#[optional]
#[method(collectionView:cancelPrefetchingForItemsAtIndexPaths:)]
unsafe fn collectionView_cancelPrefetchingForItemsAtIndexPaths(
&self,
collection_view: &UICollectionView,
index_paths: &NSArray<NSIndexPath>,
);
}
unsafe impl ProtocolType for dyn UICollectionViewDataSourcePrefetching {}
);
extern_protocol!(
#[cfg(feature = "UIScrollView")]
pub unsafe trait UICollectionViewDelegate:
UIScrollViewDelegate + IsMainThreadOnly
{
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:shouldHighlightItemAtIndexPath:)]
unsafe fn collectionView_shouldHighlightItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:didHighlightItemAtIndexPath:)]
unsafe fn collectionView_didHighlightItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:didUnhighlightItemAtIndexPath:)]
unsafe fn collectionView_didUnhighlightItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:shouldSelectItemAtIndexPath:)]
unsafe fn collectionView_shouldSelectItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:shouldDeselectItemAtIndexPath:)]
unsafe fn collectionView_shouldDeselectItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:didSelectItemAtIndexPath:)]
unsafe fn collectionView_didSelectItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:didDeselectItemAtIndexPath:)]
unsafe fn collectionView_didDeselectItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:canPerformPrimaryActionForItemAtIndexPath:)]
unsafe fn collectionView_canPerformPrimaryActionForItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:performPrimaryActionForItemAtIndexPath:)]
unsafe fn collectionView_performPrimaryActionForItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
);
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UIResponder",
feature = "UIView"
))]
#[optional]
#[method(collectionView:willDisplayCell:forItemAtIndexPath:)]
unsafe fn collectionView_willDisplayCell_forItemAtIndexPath(
&self,
collection_view: &UICollectionView,
cell: &UICollectionViewCell,
index_path: &NSIndexPath,
);
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UIResponder",
feature = "UIView"
))]
#[optional]
#[method(collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:)]
unsafe fn collectionView_willDisplaySupplementaryView_forElementKind_atIndexPath(
&self,
collection_view: &UICollectionView,
view: &UICollectionReusableView,
element_kind: &NSString,
index_path: &NSIndexPath,
);
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UIResponder",
feature = "UIView"
))]
#[optional]
#[method(collectionView:didEndDisplayingCell:forItemAtIndexPath:)]
unsafe fn collectionView_didEndDisplayingCell_forItemAtIndexPath(
&self,
collection_view: &UICollectionView,
cell: &UICollectionViewCell,
index_path: &NSIndexPath,
);
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UIResponder",
feature = "UIView"
))]
#[optional]
#[method(collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:)]
unsafe fn collectionView_didEndDisplayingSupplementaryView_forElementOfKind_atIndexPath(
&self,
collection_view: &UICollectionView,
view: &UICollectionReusableView,
element_kind: &NSString,
index_path: &NSIndexPath,
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[deprecated]
#[optional]
#[method(collectionView:shouldShowMenuForItemAtIndexPath:)]
unsafe fn collectionView_shouldShowMenuForItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[deprecated]
#[optional]
#[method(collectionView:canPerformAction:forItemAtIndexPath:withSender:)]
unsafe fn collectionView_canPerformAction_forItemAtIndexPath_withSender(
&self,
collection_view: &UICollectionView,
action: Sel,
index_path: &NSIndexPath,
sender: Option<&AnyObject>,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[deprecated]
#[optional]
#[method(collectionView:performAction:forItemAtIndexPath:withSender:)]
unsafe fn collectionView_performAction_forItemAtIndexPath_withSender(
&self,
collection_view: &UICollectionView,
action: Sel,
index_path: &NSIndexPath,
sender: Option<&AnyObject>,
);
#[cfg(all(
feature = "UICollectionViewLayout",
feature = "UICollectionViewTransitionLayout",
feature = "UIResponder",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:transitionLayoutForOldLayout:newLayout:)]
unsafe fn collectionView_transitionLayoutForOldLayout_newLayout(
&self,
collection_view: &UICollectionView,
from_layout: &UICollectionViewLayout,
to_layout: &UICollectionViewLayout,
) -> Retained<UICollectionViewTransitionLayout>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:canFocusItemAtIndexPath:)]
unsafe fn collectionView_canFocusItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> bool;
#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:shouldUpdateFocusInContext:)]
unsafe fn collectionView_shouldUpdateFocusInContext(
&self,
collection_view: &UICollectionView,
context: &UICollectionViewFocusUpdateContext,
) -> bool;
#[cfg(all(
feature = "UIFocus",
feature = "UIFocusAnimationCoordinator",
feature = "UIResponder",
feature = "UIView"
))]
#[optional]
#[method(collectionView:didUpdateFocusInContext:withAnimationCoordinator:)]
unsafe fn collectionView_didUpdateFocusInContext_withAnimationCoordinator(
&self,
collection_view: &UICollectionView,
context: &UICollectionViewFocusUpdateContext,
coordinator: &UIFocusAnimationCoordinator,
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method_id(@__retain_semantics Other indexPathForPreferredFocusedViewInCollectionView:)]
unsafe fn indexPathForPreferredFocusedViewInCollectionView(
&self,
collection_view: &UICollectionView,
) -> Option<Retained<NSIndexPath>>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:selectionFollowsFocusForItemAtIndexPath:)]
unsafe fn collectionView_selectionFollowsFocusForItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:targetIndexPathForMoveOfItemFromOriginalIndexPath:atCurrentIndexPath:toProposedIndexPath:)]
unsafe fn collectionView_targetIndexPathForMoveOfItemFromOriginalIndexPath_atCurrentIndexPath_toProposedIndexPath(
&self,
collection_view: &UICollectionView,
original_index_path: &NSIndexPath,
current_index_path: &NSIndexPath,
proposed_index_path: &NSIndexPath,
) -> Retained<NSIndexPath>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[deprecated]
#[optional]
#[method_id(@__retain_semantics Other collectionView:targetIndexPathForMoveFromItemAtIndexPath:toProposedIndexPath:)]
unsafe fn collectionView_targetIndexPathForMoveFromItemAtIndexPath_toProposedIndexPath(
&self,
collection_view: &UICollectionView,
current_index_path: &NSIndexPath,
proposed_index_path: &NSIndexPath,
) -> Retained<NSIndexPath>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:targetContentOffsetForProposedContentOffset:)]
unsafe fn collectionView_targetContentOffsetForProposedContentOffset(
&self,
collection_view: &UICollectionView,
proposed_content_offset: CGPoint,
) -> CGPoint;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:canEditItemAtIndexPath:)]
unsafe fn collectionView_canEditItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> bool;
#[cfg(all(
feature = "UIResponder",
feature = "UISpringLoadedInteraction",
feature = "UIView"
))]
#[optional]
#[method(collectionView:shouldSpringLoadItemAtIndexPath:withContext:)]
unsafe fn collectionView_shouldSpringLoadItemAtIndexPath_withContext(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
context: &ProtocolObject<dyn UISpringLoadedInteractionContext>,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:shouldBeginMultipleSelectionInteractionAtIndexPath:)]
unsafe fn collectionView_shouldBeginMultipleSelectionInteractionAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionView:didBeginMultipleSelectionInteractionAtIndexPath:)]
unsafe fn collectionView_didBeginMultipleSelectionInteractionAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[optional]
#[method(collectionViewDidEndMultipleSelectionInteraction:)]
unsafe fn collectionViewDidEndMultipleSelectionInteraction(
&self,
collection_view: &UICollectionView,
);
#[cfg(all(
feature = "UIContextMenuConfiguration",
feature = "UIResponder",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:contextMenuConfigurationForItemsAtIndexPaths:point:)]
unsafe fn collectionView_contextMenuConfigurationForItemsAtIndexPaths_point(
&self,
collection_view: &UICollectionView,
index_paths: &NSArray<NSIndexPath>,
point: CGPoint,
) -> Option<Retained<UIContextMenuConfiguration>>;
#[cfg(all(
feature = "UIContextMenuConfiguration",
feature = "UIResponder",
feature = "UITargetedPreview",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:contextMenuConfiguration:highlightPreviewForItemAtIndexPath:)]
unsafe fn collectionView_contextMenuConfiguration_highlightPreviewForItemAtIndexPath(
&self,
collection_view: &UICollectionView,
configuration: &UIContextMenuConfiguration,
index_path: &NSIndexPath,
) -> Option<Retained<UITargetedPreview>>;
#[cfg(all(
feature = "UIContextMenuConfiguration",
feature = "UIResponder",
feature = "UITargetedPreview",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:contextMenuConfiguration:dismissalPreviewForItemAtIndexPath:)]
unsafe fn collectionView_contextMenuConfiguration_dismissalPreviewForItemAtIndexPath(
&self,
collection_view: &UICollectionView,
configuration: &UIContextMenuConfiguration,
index_path: &NSIndexPath,
) -> Option<Retained<UITargetedPreview>>;
#[cfg(all(
feature = "UIContextMenuConfiguration",
feature = "UIContextMenuInteraction",
feature = "UIResponder",
feature = "UIView"
))]
#[optional]
#[method(collectionView:willPerformPreviewActionForMenuWithConfiguration:animator:)]
unsafe fn collectionView_willPerformPreviewActionForMenuWithConfiguration_animator(
&self,
collection_view: &UICollectionView,
configuration: &UIContextMenuConfiguration,
animator: &ProtocolObject<dyn UIContextMenuInteractionCommitAnimating>,
);
#[cfg(all(
feature = "UIContextMenuConfiguration",
feature = "UIContextMenuInteraction",
feature = "UIResponder",
feature = "UIView"
))]
#[optional]
#[method(collectionView:willDisplayContextMenuWithConfiguration:animator:)]
unsafe fn collectionView_willDisplayContextMenuWithConfiguration_animator(
&self,
collection_view: &UICollectionView,
configuration: &UIContextMenuConfiguration,
animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
);
#[cfg(all(
feature = "UIContextMenuConfiguration",
feature = "UIContextMenuInteraction",
feature = "UIResponder",
feature = "UIView"
))]
#[optional]
#[method(collectionView:willEndContextMenuInteractionWithConfiguration:animator:)]
unsafe fn collectionView_willEndContextMenuInteractionWithConfiguration_animator(
&self,
collection_view: &UICollectionView,
configuration: &UIContextMenuConfiguration,
animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
);
#[cfg(all(
feature = "UIResponder",
feature = "UIView",
feature = "UIWindowSceneActivationConfiguration"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:sceneActivationConfigurationForItemAtIndexPath:point:)]
unsafe fn collectionView_sceneActivationConfigurationForItemAtIndexPath_point(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
point: CGPoint,
) -> Option<Retained<UIWindowSceneActivationConfiguration>>;
#[cfg(all(
feature = "UIContextMenuConfiguration",
feature = "UIResponder",
feature = "UIView"
))]
#[deprecated]
#[optional]
#[method_id(@__retain_semantics Other collectionView:contextMenuConfigurationForItemAtIndexPath:point:)]
unsafe fn collectionView_contextMenuConfigurationForItemAtIndexPath_point(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
point: CGPoint,
) -> Option<Retained<UIContextMenuConfiguration>>;
#[cfg(all(
feature = "UIContextMenuConfiguration",
feature = "UIResponder",
feature = "UITargetedPreview",
feature = "UIView"
))]
#[deprecated]
#[optional]
#[method_id(@__retain_semantics Other collectionView:previewForHighlightingContextMenuWithConfiguration:)]
unsafe fn collectionView_previewForHighlightingContextMenuWithConfiguration(
&self,
collection_view: &UICollectionView,
configuration: &UIContextMenuConfiguration,
) -> Option<Retained<UITargetedPreview>>;
#[cfg(all(
feature = "UIContextMenuConfiguration",
feature = "UIResponder",
feature = "UITargetedPreview",
feature = "UIView"
))]
#[deprecated]
#[optional]
#[method_id(@__retain_semantics Other collectionView:previewForDismissingContextMenuWithConfiguration:)]
unsafe fn collectionView_previewForDismissingContextMenuWithConfiguration(
&self,
collection_view: &UICollectionView,
configuration: &UIContextMenuConfiguration,
) -> Option<Retained<UITargetedPreview>>;
}
#[cfg(feature = "UIScrollView")]
unsafe impl ProtocolType for dyn UICollectionViewDelegate {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
pub struct UICollectionView;
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
unsafe impl ClassType for UICollectionView {
#[inherits(UIView, UIResponder, NSObject)]
type Super = UIScrollView;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView",
feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
unsafe impl CALayerDelegate for UICollectionView {}
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
unsafe impl NSCoding for UICollectionView {}
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
unsafe impl NSObjectProtocol for UICollectionView {}
#[cfg(all(
feature = "UIAppearance",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
unsafe impl UIAppearance for UICollectionView {}
#[cfg(all(
feature = "UIAppearance",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
unsafe impl UIAppearanceContainer for UICollectionView {}
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
unsafe impl UICoordinateSpace for UICollectionView {}
#[cfg(all(
feature = "UIDataSourceTranslating",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
unsafe impl UIDataSourceTranslating for UICollectionView {}
#[cfg(all(
feature = "UIDynamicBehavior",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
unsafe impl UIDynamicItem for UICollectionView {}
#[cfg(all(
feature = "UIFocus",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
unsafe impl UIFocusEnvironment for UICollectionView {}
#[cfg(all(
feature = "UIFocus",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
unsafe impl UIFocusItem for UICollectionView {}
#[cfg(all(
feature = "UIFocus",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
unsafe impl UIFocusItemContainer for UICollectionView {}
#[cfg(all(
feature = "UIFocus",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
unsafe impl UIFocusItemScrollableContainer for UICollectionView {}
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
unsafe impl UIResponderStandardEditActions for UICollectionView {}
#[cfg(all(
feature = "UIResponder",
feature = "UIScrollView",
feature = "UITraitCollection",
feature = "UIView"
))]
unsafe impl UITraitEnvironment for UICollectionView {}
extern_methods!(
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
unsafe impl UICollectionView {
#[cfg(feature = "UICollectionViewLayout")]
#[method_id(@__retain_semantics Init initWithFrame:collectionViewLayout:)]
pub unsafe fn initWithFrame_collectionViewLayout(
this: Allocated<Self>,
frame: CGRect,
layout: &UICollectionViewLayout,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[cfg(feature = "UICollectionViewLayout")]
#[method_id(@__retain_semantics Other collectionViewLayout)]
pub unsafe fn collectionViewLayout(&self) -> Retained<UICollectionViewLayout>;
#[cfg(feature = "UICollectionViewLayout")]
#[method(setCollectionViewLayout:)]
pub unsafe fn setCollectionViewLayout(
&self,
collection_view_layout: &UICollectionViewLayout,
);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UICollectionViewDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn UICollectionViewDelegate>>,
);
#[method_id(@__retain_semantics Other dataSource)]
pub unsafe fn dataSource(
&self,
) -> Option<Retained<ProtocolObject<dyn UICollectionViewDataSource>>>;
#[method(setDataSource:)]
pub unsafe fn setDataSource(
&self,
data_source: Option<&ProtocolObject<dyn UICollectionViewDataSource>>,
);
#[method_id(@__retain_semantics Other prefetchDataSource)]
pub unsafe fn prefetchDataSource(
&self,
) -> Option<Retained<ProtocolObject<dyn UICollectionViewDataSourcePrefetching>>>;
#[method(setPrefetchDataSource:)]
pub unsafe fn setPrefetchDataSource(
&self,
prefetch_data_source: Option<
&ProtocolObject<dyn UICollectionViewDataSourcePrefetching>,
>,
);
#[method(isPrefetchingEnabled)]
pub unsafe fn isPrefetchingEnabled(&self) -> bool;
#[method(setPrefetchingEnabled:)]
pub unsafe fn setPrefetchingEnabled(&self, prefetching_enabled: bool);
#[method_id(@__retain_semantics Other dragDelegate)]
pub unsafe fn dragDelegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UICollectionViewDragDelegate>>>;
#[method(setDragDelegate:)]
pub unsafe fn setDragDelegate(
&self,
drag_delegate: Option<&ProtocolObject<dyn UICollectionViewDragDelegate>>,
);
#[method_id(@__retain_semantics Other dropDelegate)]
pub unsafe fn dropDelegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UICollectionViewDropDelegate>>>;
#[method(setDropDelegate:)]
pub unsafe fn setDropDelegate(
&self,
drop_delegate: Option<&ProtocolObject<dyn UICollectionViewDropDelegate>>,
);
#[method(dragInteractionEnabled)]
pub unsafe fn dragInteractionEnabled(&self) -> bool;
#[method(setDragInteractionEnabled:)]
pub unsafe fn setDragInteractionEnabled(&self, drag_interaction_enabled: bool);
#[cfg(feature = "UIContextMenuInteraction")]
#[method_id(@__retain_semantics Other contextMenuInteraction)]
pub unsafe fn contextMenuInteraction(&self) -> Option<Retained<UIContextMenuInteraction>>;
#[method(reorderingCadence)]
pub unsafe fn reorderingCadence(&self) -> UICollectionViewReorderingCadence;
#[method(setReorderingCadence:)]
pub unsafe fn setReorderingCadence(
&self,
reordering_cadence: UICollectionViewReorderingCadence,
);
#[method(selfSizingInvalidation)]
pub unsafe fn selfSizingInvalidation(&self) -> UICollectionViewSelfSizingInvalidation;
#[method(setSelfSizingInvalidation:)]
pub unsafe fn setSelfSizingInvalidation(
&self,
self_sizing_invalidation: UICollectionViewSelfSizingInvalidation,
);
#[method_id(@__retain_semantics Other backgroundView)]
pub unsafe fn backgroundView(&self) -> Option<Retained<UIView>>;
#[method(setBackgroundView:)]
pub unsafe fn setBackgroundView(&self, background_view: Option<&UIView>);
#[method(registerClass:forCellWithReuseIdentifier:)]
pub unsafe fn registerClass_forCellWithReuseIdentifier(
&self,
cell_class: Option<&AnyClass>,
identifier: &NSString,
);
#[cfg(feature = "UINib")]
#[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
#[method(registerNib:forCellWithReuseIdentifier:)]
pub unsafe fn registerNib_forCellWithReuseIdentifier(
&self,
nib: Option<&UINib>,
identifier: &NSString,
);
#[method(registerClass:forSupplementaryViewOfKind:withReuseIdentifier:)]
pub unsafe fn registerClass_forSupplementaryViewOfKind_withReuseIdentifier(
&self,
view_class: Option<&AnyClass>,
element_kind: &NSString,
identifier: &NSString,
);
#[cfg(feature = "UINib")]
#[deprecated = "Loading Interface Builder products will not be supported in a future version of visionOS."]
#[method(registerNib:forSupplementaryViewOfKind:withReuseIdentifier:)]
pub unsafe fn registerNib_forSupplementaryViewOfKind_withReuseIdentifier(
&self,
nib: Option<&UINib>,
kind: &NSString,
identifier: &NSString,
);
#[cfg(feature = "UICollectionViewCell")]
#[method_id(@__retain_semantics Other dequeueReusableCellWithReuseIdentifier:forIndexPath:)]
pub unsafe fn dequeueReusableCellWithReuseIdentifier_forIndexPath(
&self,
identifier: &NSString,
index_path: &NSIndexPath,
) -> Retained<UICollectionViewCell>;
#[cfg(feature = "UICollectionViewCell")]
#[method_id(@__retain_semantics Other dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath:)]
pub unsafe fn dequeueReusableSupplementaryViewOfKind_withReuseIdentifier_forIndexPath(
&self,
element_kind: &NSString,
identifier: &NSString,
index_path: &NSIndexPath,
) -> Retained<UICollectionReusableView>;
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UICollectionViewItemRegistration"
))]
#[method_id(@__retain_semantics Other dequeueConfiguredReusableCellWithRegistration:forIndexPath:item:)]
pub unsafe fn dequeueConfiguredReusableCellWithRegistration_forIndexPath_item(
&self,
registration: &UICollectionViewCellRegistration,
index_path: &NSIndexPath,
item: &AnyObject,
) -> Retained<UICollectionViewCell>;
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UICollectionViewItemRegistration"
))]
#[method_id(@__retain_semantics Other dequeueConfiguredReusableSupplementaryViewWithRegistration:forIndexPath:)]
pub unsafe fn dequeueConfiguredReusableSupplementaryViewWithRegistration_forIndexPath(
&self,
registration: &UICollectionViewSupplementaryRegistration,
index_path: &NSIndexPath,
) -> Retained<UICollectionReusableView>;
#[method(allowsSelection)]
pub unsafe fn allowsSelection(&self) -> bool;
#[method(setAllowsSelection:)]
pub unsafe fn setAllowsSelection(&self, allows_selection: bool);
#[method(allowsMultipleSelection)]
pub unsafe fn allowsMultipleSelection(&self) -> bool;
#[method(setAllowsMultipleSelection:)]
pub unsafe fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
#[method_id(@__retain_semantics Other indexPathsForSelectedItems)]
pub unsafe fn indexPathsForSelectedItems(&self) -> Option<Retained<NSArray<NSIndexPath>>>;
#[method(selectItemAtIndexPath:animated:scrollPosition:)]
pub unsafe fn selectItemAtIndexPath_animated_scrollPosition(
&self,
index_path: Option<&NSIndexPath>,
animated: bool,
scroll_position: UICollectionViewScrollPosition,
);
#[method(deselectItemAtIndexPath:animated:)]
pub unsafe fn deselectItemAtIndexPath_animated(
&self,
index_path: &NSIndexPath,
animated: bool,
);
#[method(hasUncommittedUpdates)]
pub unsafe fn hasUncommittedUpdates(&self) -> bool;
#[method(reloadData)]
pub unsafe fn reloadData(&self);
#[cfg(feature = "UICollectionViewLayout")]
#[method(setCollectionViewLayout:animated:)]
pub unsafe fn setCollectionViewLayout_animated(
&self,
layout: &UICollectionViewLayout,
animated: bool,
);
#[cfg(all(feature = "UICollectionViewLayout", feature = "block2"))]
#[method(setCollectionViewLayout:animated:completion:)]
pub unsafe fn setCollectionViewLayout_animated_completion(
&self,
layout: &UICollectionViewLayout,
animated: bool,
completion: Option<&block2::Block<dyn Fn(Bool)>>,
);
#[cfg(all(
feature = "UICollectionViewLayout",
feature = "UICollectionViewTransitionLayout",
feature = "block2"
))]
#[method_id(@__retain_semantics Other startInteractiveTransitionToCollectionViewLayout:completion:)]
pub unsafe fn startInteractiveTransitionToCollectionViewLayout_completion(
&self,
layout: &UICollectionViewLayout,
completion: UICollectionViewLayoutInteractiveTransitionCompletion,
) -> Retained<UICollectionViewTransitionLayout>;
#[method(finishInteractiveTransition)]
pub unsafe fn finishInteractiveTransition(&self);
#[method(cancelInteractiveTransition)]
pub unsafe fn cancelInteractiveTransition(&self);
#[method(numberOfSections)]
pub unsafe fn numberOfSections(&self) -> NSInteger;
#[method(numberOfItemsInSection:)]
pub unsafe fn numberOfItemsInSection(&self, section: NSInteger) -> NSInteger;
#[cfg(feature = "UICollectionViewLayout")]
#[method_id(@__retain_semantics Other layoutAttributesForItemAtIndexPath:)]
pub unsafe fn layoutAttributesForItemAtIndexPath(
&self,
index_path: &NSIndexPath,
) -> Option<Retained<UICollectionViewLayoutAttributes>>;
#[cfg(feature = "UICollectionViewLayout")]
#[method_id(@__retain_semantics Other layoutAttributesForSupplementaryElementOfKind:atIndexPath:)]
pub unsafe fn layoutAttributesForSupplementaryElementOfKind_atIndexPath(
&self,
kind: &NSString,
index_path: &NSIndexPath,
) -> Option<Retained<UICollectionViewLayoutAttributes>>;
#[method_id(@__retain_semantics Other indexPathForItemAtPoint:)]
pub unsafe fn indexPathForItemAtPoint(
&self,
point: CGPoint,
) -> Option<Retained<NSIndexPath>>;
#[cfg(feature = "UICollectionViewCell")]
#[method_id(@__retain_semantics Other indexPathForCell:)]
pub unsafe fn indexPathForCell(
&self,
cell: &UICollectionViewCell,
) -> Option<Retained<NSIndexPath>>;
#[cfg(feature = "UICollectionViewCell")]
#[method_id(@__retain_semantics Other cellForItemAtIndexPath:)]
pub unsafe fn cellForItemAtIndexPath(
&self,
index_path: &NSIndexPath,
) -> Option<Retained<UICollectionViewCell>>;
#[cfg(feature = "UICollectionViewCell")]
#[method_id(@__retain_semantics Other visibleCells)]
pub unsafe fn visibleCells(&self) -> Retained<NSArray<UICollectionViewCell>>;
#[method_id(@__retain_semantics Other indexPathsForVisibleItems)]
pub unsafe fn indexPathsForVisibleItems(&self) -> Retained<NSArray<NSIndexPath>>;
#[cfg(feature = "UICollectionViewCell")]
#[method_id(@__retain_semantics Other supplementaryViewForElementKind:atIndexPath:)]
pub unsafe fn supplementaryViewForElementKind_atIndexPath(
&self,
element_kind: &NSString,
index_path: &NSIndexPath,
) -> Option<Retained<UICollectionReusableView>>;
#[cfg(feature = "UICollectionViewCell")]
#[method_id(@__retain_semantics Other visibleSupplementaryViewsOfKind:)]
pub unsafe fn visibleSupplementaryViewsOfKind(
&self,
element_kind: &NSString,
) -> Retained<NSArray<UICollectionReusableView>>;
#[method_id(@__retain_semantics Other indexPathsForVisibleSupplementaryElementsOfKind:)]
pub unsafe fn indexPathsForVisibleSupplementaryElementsOfKind(
&self,
element_kind: &NSString,
) -> Retained<NSArray<NSIndexPath>>;
#[method(scrollToItemAtIndexPath:atScrollPosition:animated:)]
pub unsafe fn scrollToItemAtIndexPath_atScrollPosition_animated(
&self,
index_path: &NSIndexPath,
scroll_position: UICollectionViewScrollPosition,
animated: bool,
);
#[method(insertSections:)]
pub unsafe fn insertSections(&self, sections: &NSIndexSet);
#[method(deleteSections:)]
pub unsafe fn deleteSections(&self, sections: &NSIndexSet);
#[method(moveSection:toSection:)]
pub unsafe fn moveSection_toSection(&self, section: NSInteger, new_section: NSInteger);
#[method(reloadSections:)]
pub unsafe fn reloadSections(&self, sections: &NSIndexSet);
#[method(insertItemsAtIndexPaths:)]
pub unsafe fn insertItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
#[method(deleteItemsAtIndexPaths:)]
pub unsafe fn deleteItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
#[method(moveItemAtIndexPath:toIndexPath:)]
pub unsafe fn moveItemAtIndexPath_toIndexPath(
&self,
index_path: &NSIndexPath,
new_index_path: &NSIndexPath,
);
#[method(reloadItemsAtIndexPaths:)]
pub unsafe fn reloadItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
#[method(reconfigureItemsAtIndexPaths:)]
pub unsafe fn reconfigureItemsAtIndexPaths(&self, index_paths: &NSArray<NSIndexPath>);
#[cfg(feature = "block2")]
#[method(performBatchUpdates:completion:)]
pub unsafe fn performBatchUpdates_completion(
&self,
updates: Option<&block2::Block<dyn Fn() + '_>>,
completion: Option<&block2::Block<dyn Fn(Bool)>>,
);
#[method(beginInteractiveMovementForItemAtIndexPath:)]
pub unsafe fn beginInteractiveMovementForItemAtIndexPath(
&self,
index_path: &NSIndexPath,
) -> bool;
#[method(updateInteractiveMovementTargetPosition:)]
pub unsafe fn updateInteractiveMovementTargetPosition(&self, target_position: CGPoint);
#[method(endInteractiveMovement)]
pub unsafe fn endInteractiveMovement(&self);
#[method(cancelInteractiveMovement)]
pub unsafe fn cancelInteractiveMovement(&self);
#[method(remembersLastFocusedIndexPath)]
pub unsafe fn remembersLastFocusedIndexPath(&self) -> bool;
#[method(setRemembersLastFocusedIndexPath:)]
pub unsafe fn setRemembersLastFocusedIndexPath(
&self,
remembers_last_focused_index_path: bool,
);
#[method(selectionFollowsFocus)]
pub unsafe fn selectionFollowsFocus(&self) -> bool;
#[method(setSelectionFollowsFocus:)]
pub unsafe fn setSelectionFollowsFocus(&self, selection_follows_focus: bool);
#[method(allowsFocus)]
pub unsafe fn allowsFocus(&self) -> bool;
#[method(setAllowsFocus:)]
pub unsafe fn setAllowsFocus(&self, allows_focus: bool);
#[method(allowsFocusDuringEditing)]
pub unsafe fn allowsFocusDuringEditing(&self) -> bool;
#[method(setAllowsFocusDuringEditing:)]
pub unsafe fn setAllowsFocusDuringEditing(&self, allows_focus_during_editing: bool);
#[method(hasActiveDrag)]
pub unsafe fn hasActiveDrag(&self) -> bool;
#[method(hasActiveDrop)]
pub unsafe fn hasActiveDrop(&self) -> bool;
#[method(isEditing)]
pub unsafe fn isEditing(&self) -> bool;
#[method(setEditing:)]
pub unsafe fn setEditing(&self, editing: bool);
#[method(allowsSelectionDuringEditing)]
pub unsafe fn allowsSelectionDuringEditing(&self) -> bool;
#[method(setAllowsSelectionDuringEditing:)]
pub unsafe fn setAllowsSelectionDuringEditing(&self, allows_selection_during_editing: bool);
#[method(allowsMultipleSelectionDuringEditing)]
pub unsafe fn allowsMultipleSelectionDuringEditing(&self) -> bool;
#[method(setAllowsMultipleSelectionDuringEditing:)]
pub unsafe fn setAllowsMultipleSelectionDuringEditing(
&self,
allows_multiple_selection_during_editing: bool,
);
}
);
extern_methods!(
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
unsafe impl UICollectionView {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
}
);
extern_methods!(
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
unsafe impl UICollectionView {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
unsafe impl UICollectionView {}
);
#[cfg(all(
feature = "UIResponder",
feature = "UIScrollView",
feature = "UISpringLoadedInteractionSupporting",
feature = "UIView"
))]
unsafe impl UISpringLoadedInteractionSupporting for UICollectionView {}
extern_protocol!(
pub unsafe trait UICollectionViewDragDelegate:
NSObjectProtocol + IsMainThreadOnly
{
#[cfg(all(
feature = "UIDragItem",
feature = "UIDragSession",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[method_id(@__retain_semantics Other collectionView:itemsForBeginningDragSession:atIndexPath:)]
unsafe fn collectionView_itemsForBeginningDragSession_atIndexPath(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDragSession>,
index_path: &NSIndexPath,
) -> Retained<NSArray<UIDragItem>>;
#[cfg(all(
feature = "UIDragItem",
feature = "UIDragSession",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:itemsForAddingToDragSession:atIndexPath:point:)]
unsafe fn collectionView_itemsForAddingToDragSession_atIndexPath_point(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDragSession>,
index_path: &NSIndexPath,
point: CGPoint,
) -> Retained<NSArray<UIDragItem>>;
#[cfg(all(
feature = "UIDragPreviewParameters",
feature = "UIPreviewParameters",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:dragPreviewParametersForItemAtIndexPath:)]
unsafe fn collectionView_dragPreviewParametersForItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> Option<Retained<UIDragPreviewParameters>>;
#[cfg(all(
feature = "UIDragSession",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method(collectionView:dragSessionWillBegin:)]
unsafe fn collectionView_dragSessionWillBegin(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDragSession>,
);
#[cfg(all(
feature = "UIDragSession",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method(collectionView:dragSessionDidEnd:)]
unsafe fn collectionView_dragSessionDidEnd(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDragSession>,
);
#[cfg(all(
feature = "UIDragSession",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method(collectionView:dragSessionAllowsMoveOperation:)]
unsafe fn collectionView_dragSessionAllowsMoveOperation(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDragSession>,
) -> bool;
#[cfg(all(
feature = "UIDragSession",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method(collectionView:dragSessionIsRestrictedToDraggingApplication:)]
unsafe fn collectionView_dragSessionIsRestrictedToDraggingApplication(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDragSession>,
) -> bool;
}
unsafe impl ProtocolType for dyn UICollectionViewDragDelegate {}
);
extern_protocol!(
pub unsafe trait UICollectionViewDropDelegate:
NSObjectProtocol + IsMainThreadOnly
{
#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
#[method(collectionView:performDropWithCoordinator:)]
unsafe fn collectionView_performDropWithCoordinator(
&self,
collection_view: &UICollectionView,
coordinator: &ProtocolObject<dyn UICollectionViewDropCoordinator>,
);
#[cfg(all(
feature = "UIDragSession",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method(collectionView:canHandleDropSession:)]
unsafe fn collectionView_canHandleDropSession(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDropSession>,
) -> bool;
#[cfg(all(
feature = "UIDragSession",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method(collectionView:dropSessionDidEnter:)]
unsafe fn collectionView_dropSessionDidEnter(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDropSession>,
);
#[cfg(all(
feature = "UIDragSession",
feature = "UIDropInteraction",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:dropSessionDidUpdate:withDestinationIndexPath:)]
unsafe fn collectionView_dropSessionDidUpdate_withDestinationIndexPath(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDropSession>,
destination_index_path: Option<&NSIndexPath>,
) -> Retained<UICollectionViewDropProposal>;
#[cfg(all(
feature = "UIDragSession",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method(collectionView:dropSessionDidExit:)]
unsafe fn collectionView_dropSessionDidExit(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDropSession>,
);
#[cfg(all(
feature = "UIDragSession",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method(collectionView:dropSessionDidEnd:)]
unsafe fn collectionView_dropSessionDidEnd(
&self,
collection_view: &UICollectionView,
session: &ProtocolObject<dyn UIDropSession>,
);
#[cfg(all(
feature = "UIDragPreviewParameters",
feature = "UIPreviewParameters",
feature = "UIResponder",
feature = "UIScrollView",
feature = "UIView"
))]
#[optional]
#[method_id(@__retain_semantics Other collectionView:dropPreviewParametersForItemAtIndexPath:)]
unsafe fn collectionView_dropPreviewParametersForItemAtIndexPath(
&self,
collection_view: &UICollectionView,
index_path: &NSIndexPath,
) -> Option<Retained<UIDragPreviewParameters>>;
}
unsafe impl ProtocolType for dyn UICollectionViewDropDelegate {}
);
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UICollectionViewDropIntent(pub NSInteger);
impl UICollectionViewDropIntent {
#[doc(alias = "UICollectionViewDropIntentUnspecified")]
pub const Unspecified: Self = Self(0);
#[doc(alias = "UICollectionViewDropIntentInsertAtDestinationIndexPath")]
pub const InsertAtDestinationIndexPath: Self = Self(1);
#[doc(alias = "UICollectionViewDropIntentInsertIntoDestinationIndexPath")]
pub const InsertIntoDestinationIndexPath: Self = Self(2);
}
unsafe impl Encode for UICollectionViewDropIntent {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UICollectionViewDropIntent {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIDropInteraction")]
pub struct UICollectionViewDropProposal;
#[cfg(feature = "UIDropInteraction")]
unsafe impl ClassType for UICollectionViewDropProposal {
#[inherits(NSObject)]
type Super = UIDropProposal;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "UIDropInteraction")]
unsafe impl NSCopying for UICollectionViewDropProposal {}
#[cfg(feature = "UIDropInteraction")]
unsafe impl NSObjectProtocol for UICollectionViewDropProposal {}
extern_methods!(
#[cfg(feature = "UIDropInteraction")]
unsafe impl UICollectionViewDropProposal {
#[method_id(@__retain_semantics Init initWithDropOperation:intent:)]
pub unsafe fn initWithDropOperation_intent(
this: Allocated<Self>,
operation: UIDropOperation,
intent: UICollectionViewDropIntent,
) -> Retained<Self>;
#[method(intent)]
pub unsafe fn intent(&self) -> UICollectionViewDropIntent;
}
);
extern_methods!(
#[cfg(feature = "UIDropInteraction")]
unsafe impl UICollectionViewDropProposal {
#[method_id(@__retain_semantics Init initWithDropOperation:)]
pub unsafe fn initWithDropOperation(
this: Allocated<Self>,
operation: UIDropOperation,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait UICollectionViewDropCoordinator:
NSObjectProtocol + IsMainThreadOnly
{
#[method_id(@__retain_semantics Other items)]
unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UICollectionViewDropItem>>>;
#[method_id(@__retain_semantics Other destinationIndexPath)]
unsafe fn destinationIndexPath(&self) -> Option<Retained<NSIndexPath>>;
#[cfg(feature = "UIDropInteraction")]
#[method_id(@__retain_semantics Other proposal)]
unsafe fn proposal(&self) -> Retained<UICollectionViewDropProposal>;
#[cfg(feature = "UIDragSession")]
#[method_id(@__retain_semantics Other session)]
unsafe fn session(&self) -> Retained<ProtocolObject<dyn UIDropSession>>;
#[cfg(all(feature = "UIDragInteraction", feature = "UIDragItem"))]
#[method_id(@__retain_semantics Other dropItem:toPlaceholder:)]
unsafe fn dropItem_toPlaceholder(
&self,
drag_item: &UIDragItem,
placeholder: &UICollectionViewDropPlaceholder,
) -> Retained<ProtocolObject<dyn UICollectionViewDropPlaceholderContext>>;
#[cfg(all(feature = "UIDragInteraction", feature = "UIDragItem"))]
#[method_id(@__retain_semantics Other dropItem:toItemAtIndexPath:)]
unsafe fn dropItem_toItemAtIndexPath(
&self,
drag_item: &UIDragItem,
index_path: &NSIndexPath,
) -> Retained<ProtocolObject<dyn UIDragAnimating>>;
#[cfg(all(feature = "UIDragInteraction", feature = "UIDragItem"))]
#[method_id(@__retain_semantics Other dropItem:intoItemAtIndexPath:rect:)]
unsafe fn dropItem_intoItemAtIndexPath_rect(
&self,
drag_item: &UIDragItem,
index_path: &NSIndexPath,
rect: CGRect,
) -> Retained<ProtocolObject<dyn UIDragAnimating>>;
#[cfg(all(
feature = "UIDragInteraction",
feature = "UIDragItem",
feature = "UITargetedDragPreview",
feature = "UITargetedPreview"
))]
#[method_id(@__retain_semantics Other dropItem:toTarget:)]
unsafe fn dropItem_toTarget(
&self,
drag_item: &UIDragItem,
target: &UIDragPreviewTarget,
) -> Retained<ProtocolObject<dyn UIDragAnimating>>;
}
unsafe impl ProtocolType for dyn UICollectionViewDropCoordinator {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UICollectionViewPlaceholder;
unsafe impl ClassType for UICollectionViewPlaceholder {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
unsafe impl NSObjectProtocol for UICollectionViewPlaceholder {}
extern_methods!(
unsafe impl UICollectionViewPlaceholder {
#[method_id(@__retain_semantics Init initWithInsertionIndexPath:reuseIdentifier:)]
pub unsafe fn initWithInsertionIndexPath_reuseIdentifier(
this: Allocated<Self>,
insertion_index_path: &NSIndexPath,
reuse_identifier: &NSString,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UIResponder",
feature = "UIView",
feature = "block2"
))]
#[method(cellUpdateHandler)]
pub unsafe fn cellUpdateHandler(
&self,
) -> *mut block2::Block<dyn Fn(NonNull<UICollectionViewCell>)>;
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UIResponder",
feature = "UIView",
feature = "block2"
))]
#[method(setCellUpdateHandler:)]
pub unsafe fn setCellUpdateHandler(
&self,
cell_update_handler: Option<&block2::Block<dyn Fn(NonNull<UICollectionViewCell>)>>,
);
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UICollectionViewDropPlaceholder;
unsafe impl ClassType for UICollectionViewDropPlaceholder {
#[inherits(NSObject)]
type Super = UICollectionViewPlaceholder;
type Mutability = MainThreadOnly;
}
);
unsafe impl NSObjectProtocol for UICollectionViewDropPlaceholder {}
extern_methods!(
unsafe impl UICollectionViewDropPlaceholder {
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UIDragPreviewParameters",
feature = "UIPreviewParameters",
feature = "UIResponder",
feature = "UIView",
feature = "block2"
))]
#[method(previewParametersProvider)]
pub unsafe fn previewParametersProvider(
&self,
) -> *mut block2::Block<dyn Fn(NonNull<UICollectionViewCell>) -> *mut UIDragPreviewParameters>;
#[cfg(all(
feature = "UICollectionViewCell",
feature = "UIDragPreviewParameters",
feature = "UIPreviewParameters",
feature = "UIResponder",
feature = "UIView",
feature = "block2"
))]
#[method(setPreviewParametersProvider:)]
pub unsafe fn setPreviewParametersProvider(
&self,
preview_parameters_provider: Option<
&block2::Block<
dyn Fn(NonNull<UICollectionViewCell>) -> *mut UIDragPreviewParameters,
>,
>,
);
}
);
extern_methods!(
unsafe impl UICollectionViewDropPlaceholder {
#[method_id(@__retain_semantics Init initWithInsertionIndexPath:reuseIdentifier:)]
pub unsafe fn initWithInsertionIndexPath_reuseIdentifier(
this: Allocated<Self>,
insertion_index_path: &NSIndexPath,
reuse_identifier: &NSString,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait UICollectionViewDropItem: NSObjectProtocol + IsMainThreadOnly {
#[cfg(feature = "UIDragItem")]
#[method_id(@__retain_semantics Other dragItem)]
unsafe fn dragItem(&self) -> Retained<UIDragItem>;
#[method_id(@__retain_semantics Other sourceIndexPath)]
unsafe fn sourceIndexPath(&self) -> Option<Retained<NSIndexPath>>;
#[method(previewSize)]
unsafe fn previewSize(&self) -> CGSize;
}
unsafe impl ProtocolType for dyn UICollectionViewDropItem {}
);
extern_protocol!(
#[cfg(feature = "UIDragInteraction")]
pub unsafe trait UICollectionViewDropPlaceholderContext:
UIDragAnimating + IsMainThreadOnly
{
#[cfg(feature = "UIDragItem")]
#[method_id(@__retain_semantics Other dragItem)]
unsafe fn dragItem(&self) -> Retained<UIDragItem>;
#[cfg(feature = "block2")]
#[method(commitInsertionWithDataSourceUpdates:)]
unsafe fn commitInsertionWithDataSourceUpdates(
&self,
data_source_updates: &block2::Block<dyn Fn(NonNull<NSIndexPath>) + '_>,
) -> bool;
#[method(deletePlaceholder)]
unsafe fn deletePlaceholder(&self) -> bool;
#[method(setNeedsCellUpdate)]
unsafe fn setNeedsCellUpdate(&self);
}
#[cfg(feature = "UIDragInteraction")]
unsafe impl ProtocolType for dyn UICollectionViewDropPlaceholderContext {}
);