IGListSingleSectionController


@interface IGListSingleSectionController : IGListSectionController

This section controller is meant to make building simple, single-cell lists easier. By providing the type of cell, a block to configure the cell, and a block to return the size of a cell, you can use an IGListAdapter-powered list with a simpler architecture.

  • Creates a new section controller for a given cell type that will always have only one cell when present in a list.

    Warning

    Be VERY CAREFUL not to create retain cycles by holding strong references to: the object that owns the adapter (usually self) or the IGListAdapter. Pass in locally scoped objects or use weak references!

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithCellClass:(nonnull Class)cellClass
           configureBlock:
               (nonnull IGListSingleSectionCellConfigureBlock)configureBlock
                sizeBlock:(nonnull IGListSingleSectionCellSizeBlock)sizeBlock;

    Swift

    init(cellClass: AnyClass, configureBlock: @escaping ListSingleSectionCellConfigureBlock, sizeBlock: @escaping ListSingleSectionCellSizeBlock)

    Parameters

    cellClass

    The UICollectionViewCell subclass for the single cell.

    configureBlock

    A block that configures the cell with the item given to the section controller.

    sizeBlock

    A block that returns the size for the cell given the collection context.

    Return Value

    A new section controller.

  • Creates a new section controller for a given nib name and bundle that will always have only one cell when present in a list.

    Warning

    Be VERY CAREFUL not to create retain cycles by holding strong references to: the object that owns the adapter (usually self) or the IGListAdapter. Pass in locally scoped objects or use weak references!

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithNibName:(nonnull NSString *)nibName
                 bundle:(nullable NSBundle *)bundle
         configureBlock:
             (nonnull IGListSingleSectionCellConfigureBlock)configureBlock
              sizeBlock:(nonnull IGListSingleSectionCellSizeBlock)sizeBlock;

    Swift

    init(nibName: String, bundle: Bundle?, configureBlock: @escaping ListSingleSectionCellConfigureBlock, sizeBlock: @escaping ListSingleSectionCellSizeBlock)

    Parameters

    nibName

    The name of the nib file for the single cell.

    bundle

    The bundle in which to search for the nib file. If nil, this method looks for the file in the main bundle.

    configureBlock

    A block that configures the cell with the item given to the section controller.

    sizeBlock

    A block that returns the size for the cell given the collection context.

    Return Value

    A new section controller.

  • Creates a new section controller for a given storyboard cell identifier that will always have only one cell when present in a list.

    Warning

    Be VERY CAREFUL not to create retain cycles by holding strong references to: the object that owns the adapter (usually self) or the IGListAdapter. Pass in locally scoped objects or use weak references!

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithStoryboardCellIdentifier:(nonnull NSString *)identifier
                          configureBlock:
                              (nonnull IGListSingleSectionCellConfigureBlock)
                                  configureBlock
                               sizeBlock:(nonnull IGListSingleSectionCellSizeBlock)
                                             sizeBlock;

    Swift

    init(storyboardCellIdentifier identifier: String, configureBlock: @escaping ListSingleSectionCellConfigureBlock, sizeBlock: @escaping ListSingleSectionCellSizeBlock)

    Parameters

    identifier

    The identifier of the cell prototype in storyboard.

    configureBlock

    A block that configures the cell with the item given to the section controller.

    sizeBlock

    A block that returns the size for the cell given the collection context.

    Return Value

    A new section controller.

  • An optional delegate that handles selection and deselection.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable)
        id<IGListSingleSectionControllerDelegate>
            selectionDelegate;

    Swift

    weak var selectionDelegate: ListSingleSectionControllerDelegate? { get set }