To run the example project, clone the repo, and run CompositionalLayoutSpreadsheetExample.xcodeproj
from the example directory.
iOS 13.0 + Swift 5.0 +
CompositionalLayoutSpreadsheet is available through Swift Package Manager. To install it, simply add the following line to your Podfile:
dependencies: [
.package(url: "https://github.com/ericleiyang/CompositionalLayoutSpreadsheet.git", .upToNextMajor(from: "1.0.0"))
]
- Spreadsheet like collection view
- Compositional collection view layout
- Sticky column at the left
- iPhone screen sizes supported
- iPad screen sizes supported
- Device rotation supported
- Custom sticky size width supported
- Custom value cell size supported
- Custom sticky cell font/color supported
- Custom value cell supported
- Sticky row as the header
- Multiple sticky columns at the left
- Multiple sticky rows as the header
- Various row sizes supported
- Various column sizes supported
A short introduction on how to get started:
- The sticky column is represented as
ReusableSupplementaryView
. - The values are represented as one
NSCollectionLayoutSection
with multipleNSCollectionLayoutGroup
. - Default cell is the
ValueCell
with one label displayed. It can be replaced by customUICollectionViewCell
when callingconfigureHierarchy
of theCompositionalLayoutSpreadsheet
.
A short example:
//Init
let provider = CompositionalLayoutSpreadsheet()
// Use default ValueCell
provider.configureHierarchy(
stikyColumnDatas: stikyColumnDatas,
rowDatas: rowDatas,
parentView: view
)
To use the custom cell:
//Init
let provider = CompositionalLayoutSpreadsheet()
// Use default ValueCell
provider.configureHierarchy(
stikyColumnDatas: stikyColumnDatas,
rowDatas: rowDatas,
cell: YOUR CELL,
cellReuseIdentifier: The reuse identifier of YOUR CELL
)
Reload after data updated:
provider.update(
stikyColumnDatas: UPDATED COLUMN DATA,
rowDatas: UPDATED VALUES
)
Enjoy ;)
Please refer to the demo application or contact me directly.
Eric Yang
CompositionalLayoutSpreadsheet is available under the MIT license. See the LICENSE file for more info.