RRCarouselRenderableDataSource

Objective-C

@protocol RRCarouselRenderableDataSource <NSObject>

Swift

protocol RRCarouselRenderableDataSource : NSObjectProtocol

This protocol is used by the RRCarouselRenderable class to get the displayed items in the carousel

  • This method should return how many items should be selectable within the carosuel

    Declaration

    Objective-C

    - (NSUInteger)numberOfItemsInCarousel:(nonnull RRCarouselRenderable *)carousel;

    Swift

    func numberOfItems(inCarousel carousel: RRCarouselRenderable) -> UInt

    Parameters

    carousel

    The carousel renderable that calls this method

    Return Value

    The amount of items that should be selectable in the carousel

  • This method should return the renderable for a specific item index. Return tenderables in a reasonable size given the carosuel configuration. Always keep in mind that this renderable will be placed in the carosuel with its local coordinate (0, 0, 0) sitting on the carousel circle. The z axis of the renderable’s local coordinate system will always be facing the camera by rotating the object around its y axis.

    Declaration

    Objective-C

    - (nonnull RRRenderable *)carousel:(nonnull RRCarouselRenderable *)carousel
              getItemRenderableAtIndex:(NSUInteger)index;

    Swift

    func carousel(_ carousel: RRCarouselRenderable, getItemRenderableAt index: UInt) -> RRRenderable

    Parameters

    carousel

    The carousel renderable that calls this method

    Return Value

    The item renderable to be shown inside the carousel. Keep the placement/orientation of the renderable in mind!