- Added Fixed Footers option
- Fixed footer will stick to the bottom of the screen, even when there are not enough sections to fill the screen.
To dynamically set the fixedFooter
property in your app, you can modify the property value based on some condition or user interaction. Below is an example of how you might toggle the fixedFooter
property:
// Assume you have a reference to your custom layout
let customLayout = DSCStickyLayout(stickyConfig: yourStickyConfig)
// Dynamically set `fixedFooter` based on some condition or user interaction
customLayout.fixedFooter = shouldUseFixedFooter // Replace `shouldUseFixedFooter` with your actual condition
// Assign the custom layout to your collection view
yourCollectionView.collectionViewLayout = customLayout
// Call reloadData on your collection view to apply the changes
yourCollectionView.reloadData()
Example:
StickyLayout is a collection view layout that provides sticky row and column configurability.
- Configurable Sticky options.
- Pure Swift 5.
- Horizontal and vertical scrolling support.
- Row spacing and column spacing support.
- Works with every
UICollectionView
.
Using StickyLayout quick and simple. First import StickyLayout
.
import StickyLayout
You then have the option of creating an instance of StickyConfig
, where you can specify which rows/columns you want to be sticky.
let stickyConfig = StickyLayoutConfig(stickyRowsFromTop: 1,
stickyRowsFromBottom: 0,
stickyColsFromLeft: 1,
stickyColsFromRight: 0)
let layout = StickyLayout(stickyConfig: stickyConfig)
Create an instance of StickyLayout
with your StickyConfig
as a parameter, and add it to your UICollectionView
.
UICollectionView(frame: .zero, collectionViewLayout: layout)
StickyLayout is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "StickyLayout"
If you have any suggestions or improvements please open a pull request or create an issue.
And if you found StickyLayout useful or want to show support feel free to star this repo!