MenuCollectionController
open class MenuCollectionController : BaseCollectionController<MenuItemCellPresentable>
A subclass of CollectionController
which displays the Menu for selection in a MenuViewController
.
This CollectionController
utilizes ListCollectionViewFlowLayout
which imitates the table view layout.
By default, this uses MenuItemCell
for its cells.
The associated type should conform to the MenuItemCellPresentable
to be able to configure the cells to present content of the type.
Note
Due to what maybe seems to be a bug with the Swift, methods not initially in the superclass and implemented in the subclass may not be executed. To get around this, the method needs to have an@objc
attribue.
-
Declaration
Swift
override open var collectionViewLayout: UICollectionViewLayout { get }
-
The closure to be executed when a menu item is selected
The parameter passed to this closure is a menu item object conforming to
MenuItemCellPresentable
.Declaration
Swift
open var selectionClosure: ((MenuViewController?, MenuItemCellPresentable) -> Void)?
-
The closure to be executed when the log out button is pressed
Declaration
Swift
open var logOutClosure: ((MenuViewController?) -> Void)?
-
The associated
MenuViewController
Declaration
Swift
open var menuViewController: MenuViewController? { get }
-
Returns a newly initialized menu collection controller with the specified menu items and the specified collection view to provide data and handle actions for.
Declaration
Swift
public convenience init(items: [MenuItemCellPresentable], collectionView: UICollectionView? = nil)
Parameters
items
An array of objects conforming to
MenuItemCellPresentable
.collectionView
The collection view to associate with.
Return Value
The initialized menu collection controller.
-
Declaration
Swift
override open func registerComponents()
-
Undocumented
Declaration
Swift
override open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)
-
Undocumented
Declaration
Swift
override open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
-
Undocumented
Declaration
Swift
override open func loadContent()
-
Called once the Logout button was pressed.
Declaration
Swift
open func didPressLogoutButton(_ logOutButton: UIButton)
Parameters
logOutButton
The log out button.