SupplementaryViewModel
public protocol SupplementaryViewModel : DiffableViewModel, ViewRegistrationProvider
Defines a view model that describes and configures a supplementary view in a collection.
-
The type of view that this view model represents and configures.
Declaration
Swift
associatedtype ViewType : UICollectionReusableView
-
Configures the provided view for display in the collection.
Declaration
Swift
@MainActor func configure(view: ViewType)
Parameters
view
The view to configure.
-
willDisplay()
Default implementationTells the view model that its supplementary view is about to be displayed in the collection view. This corresponds to the delegate method
collectionView(_:willDisplaySupplementaryView:forElementKind:at:)
.Default Implementation
Default implementation. Does nothing.
Declaration
Swift
@MainActor func willDisplay()
-
didEndDisplaying()
Default implementationTells the view model that its supplementary view was removed from the collection view. This corresponds to the delegate method
collectionView(_:didEndDisplayingSupplementaryView:forElementOfKind:at:)
.Default Implementation
Default implementation. Does nothing.
Declaration
Swift
@MainActor func didEndDisplaying()
-
viewClass
Extension methodThe view class for this view model.
Declaration
Swift
public var viewClass: AnyClass { get }
-
reuseIdentifier
Extension methodA default reuse identifier for cell registration. Returns the name of the class implementing the
CellViewModel
protocol.Declaration
Swift
public var reuseIdentifier: String { get }
-
eraseToAnyViewModel()
Extension methodReturns a type-erased version of this view model.
Declaration
Swift
public func eraseToAnyViewModel() -> AnySupplementaryViewModel