Skip to main content

UICollectionViewDataSource

Trait UICollectionViewDataSource 

Source
pub unsafe trait UICollectionViewDataSource: NSObjectProtocol + MainThreadOnly {
    // Provided methods
    fn collectionView_numberOfItemsInSection(
        &self,
        collection_view: &UICollectionView,
        section: NSInteger,
    ) -> NSInteger
       where Self: Sized + Message { ... }
    fn collectionView_cellForItemAtIndexPath(
        &self,
        collection_view: &UICollectionView,
        index_path: &NSIndexPath,
    ) -> Retained<UICollectionViewCell>
       where Self: Sized + Message { ... }
    fn numberOfSectionsInCollectionView(
        &self,
        collection_view: &UICollectionView,
    ) -> NSInteger
       where Self: Sized + Message { ... }
    fn collectionView_viewForSupplementaryElementOfKind_atIndexPath(
        &self,
        collection_view: &UICollectionView,
        kind: &NSString,
        index_path: &NSIndexPath,
    ) -> Retained<UICollectionReusableView>
       where Self: Sized + Message { ... }
    fn collectionView_canMoveItemAtIndexPath(
        &self,
        collection_view: &UICollectionView,
        index_path: &NSIndexPath,
    ) -> bool
       where Self: Sized + Message { ... }
    fn collectionView_moveItemAtIndexPath_toIndexPath(
        &self,
        collection_view: &UICollectionView,
        source_index_path: &NSIndexPath,
        destination_index_path: &NSIndexPath,
    )
       where Self: Sized + Message { ... }
    fn indexTitlesForCollectionView(
        &self,
        collection_view: &UICollectionView,
    ) -> Option<Retained<NSArray<NSString>>>
       where Self: Sized + Message { ... }
    fn collectionView_indexPathForIndexTitle_atIndex(
        &self,
        collection_view: &UICollectionView,
        title: &NSString,
        index: NSInteger,
    ) -> Retained<NSIndexPath>
       where Self: Sized + Message { ... }
}
Available on crate feature UICollectionView only.
Expand description

Provided Methods§

Source

fn collectionView_numberOfItemsInSection( &self, collection_view: &UICollectionView, section: NSInteger, ) -> NSInteger
where Self: Sized + Message,

Available on crate features UIResponder and UIScrollView and UIView only.
Source

fn collectionView_cellForItemAtIndexPath( &self, collection_view: &UICollectionView, index_path: &NSIndexPath, ) -> Retained<UICollectionViewCell>
where Self: Sized + Message,

Available on crate features UICollectionViewCell and UIResponder and UIScrollView and UIView only.
Source

fn numberOfSectionsInCollectionView( &self, collection_view: &UICollectionView, ) -> NSInteger
where Self: Sized + Message,

Available on crate features UIResponder and UIScrollView and UIView only.
Source

fn collectionView_viewForSupplementaryElementOfKind_atIndexPath( &self, collection_view: &UICollectionView, kind: &NSString, index_path: &NSIndexPath, ) -> Retained<UICollectionReusableView>
where Self: Sized + Message,

Available on crate features UICollectionViewCell and UIResponder and UIScrollView and UIView only.
Source

fn collectionView_canMoveItemAtIndexPath( &self, collection_view: &UICollectionView, index_path: &NSIndexPath, ) -> bool
where Self: Sized + Message,

Available on crate features UIResponder and UIScrollView and UIView only.
Source

fn collectionView_moveItemAtIndexPath_toIndexPath( &self, collection_view: &UICollectionView, source_index_path: &NSIndexPath, destination_index_path: &NSIndexPath, )
where Self: Sized + Message,

Available on crate features UIResponder and UIScrollView and UIView only.
Source

fn indexTitlesForCollectionView( &self, collection_view: &UICollectionView, ) -> Option<Retained<NSArray<NSString>>>
where Self: Sized + Message,

Available on crate features UIResponder and UIScrollView and UIView only.

Returns a list of index titles to display in the index view (e.g. [“A”, “B”, “C” … “Z”, “#”])

Source

fn collectionView_indexPathForIndexTitle_atIndex( &self, collection_view: &UICollectionView, title: &NSString, index: NSInteger, ) -> Retained<NSIndexPath>
where Self: Sized + Message,

Available on crate features UIResponder and UIScrollView and UIView only.

Returns the index path that corresponds to the given title / index. (e.g. “B”,1) Return an index path with a single index to indicate an entire section, instead of a specific item.

Trait Implementations§

Source§

impl<T> ImplementedBy<T> for dyn UICollectionViewDataSource

Source§

impl ProtocolType for dyn UICollectionViewDataSource

Source§

const NAME: &'static str = "UICollectionViewDataSource"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> UICollectionViewDataSource for ProtocolObject<T>

Implementors§

Source§

impl UICollectionViewDataSource for UICollectionViewController

Available on crate feature UICollectionViewController only.
Source§

impl<SectionIdentifierType: ?Sized + Message, ItemIdentifierType: ?Sized + Message> UICollectionViewDataSource for UICollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>

Available on crate feature UIDiffableDataSource only.