https://github.com/fluidgroup/swift-dynamic-list
Convenient component displaying elements in UICollectionView - Supports SwiftUI-based cell
https://github.com/fluidgroup/swift-dynamic-list
Last synced: 12 months ago
JSON representation
Convenient component displaying elements in UICollectionView - Supports SwiftUI-based cell
- Host: GitHub
- URL: https://github.com/fluidgroup/swift-dynamic-list
- Owner: FluidGroup
- Created: 2023-06-09T08:58:37.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-17T22:51:14.000Z (about 1 year ago)
- Last Synced: 2025-06-17T23:33:09.588Z (about 1 year ago)
- Language: Swift
- Homepage:
- Size: 14.9 MB
- Stars: 19
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# swift-dynamic-list
Convenient component displaying elements in UICollectionView - Supports SwiftUI-based cell
## Requirements
- iOS 14 +
- iPhone Platform
## Instructions
> Works in UIKit
```swift
let list = DynamicListView.init(...)
```
Setting how displays cells
```swift
list.setUp(
cellProvider: { context in
let data = context.data
// return cell
}
)
```
the context in cellProvider closure supports making SwiftUI based cells.
```swift
let cell = context.cell { state in
Text("Hello")
}
return cell
```
setting how handles the events of selected or deselected
```swift
list.setSelectionHandler { action in
switch action {
case .didSelect(let item):
print("Selected \(String(describing: item))")
case .didDeselect(let item):
print("Deselected \(String(describing: item))")
}
}
```
basic configuration is completed.
then set the content that displays.
```swift
list.setContents(contents, inSection: targetSection)
```
## Additional functions
it supports a trigger event when the scrolling will be reaching the tail.
that will be good timing to trigger loading additional data.
```swift
list.setIncrementalContentLoader {
await loadMoreData()
}
```