https://github.com/surfstudio/reactivedatadisplaymanager
https://github.com/surfstudio/reactivedatadisplaymanager
collections hacktoberfest ios rddm swift tableview tableviewcell
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/surfstudio/reactivedatadisplaymanager
- Owner: surfstudio
- License: mit
- Created: 2017-08-01T04:13:20.000Z (about 8 years ago)
- Default Branch: develop
- Last Pushed: 2024-12-17T07:40:26.000Z (10 months ago)
- Last Synced: 2025-03-31T12:05:15.182Z (6 months ago)
- Topics: collections, hacktoberfest, ios, rddm, swift, tableview, tableviewcell
- Language: Swift
- Homepage:
- Size: 6 MB
- Stars: 41
- Watchers: 24
- Forks: 13
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ReactiveDataDisplayManager
[](https://github.com/surfstudio/ReactiveDataDisplayManager/actions/workflows/Build.yml)
[](https://codebeat.co/projects/github-com-surfstudio-reactivedatadisplaymanager-develop)
[](https://codecov.io/gh/surfstudio/ReactiveDataDisplayManager)It is the whole approach to working with scrollable lists or collections.
[](https://ibb.co/Q98YSBW)
## About
This Framework was made to speed up development of scrollable collections like UITableView or UICollectionView, and to provide new way to easy extend collections functionality.
## Breaking changes
We made a massive refactoring with version 7.0.0.
Please read our [migration guide](/Documentation/MigrationGuide.md) if you were using version 6 or older.## Currently supported features
- Populating cells without implementing delegate and datasource by yourself
- Inserting, replacing or removing cells without reload
- Expanding and collapsing cells inside collection
- Moving or Drag'n'Drop cells inside collection
- Customizing of section headers and index titles## Usage
Step by step example of configuring simple list of labels.
### Prepare cell
You can layout your cell from xib or from code. It doesn't matter.
Just extend your cell to `ConfigurableItem` to fill subviews with model, when cell will be created.```swift
import ReactiveDataDisplayManagerfinal class LabelCell: UITableViewCell {
// MARK: - IBOutlets
@IBOutlet private weak var titleLabel: UILabel!
}
// MARK: - ConfigurableItem
extension LabelCell: ConfigurableItem {
typealias Model = String
func configure(with model: Model) {
titleLabel.text = model
}
}
```### Prepare collection
Just call `rddm` from collection
- add plugins for your needs
- build your ReactiveDataDisplayManager```swift
final class ExampleTableController: UIViewController {// MARK: - IBOutlets
@IBOutlet private weak var tableView: UITableView!
// MARK: - Private Properties
private lazy var ddm = tableView.rddm.baseBuilder
.add(plugin: .selectable())
.build()// MARK: - UIViewController
override func viewDidLoad() {
super.viewDidLoad()
fill()
}}
```### Fill collection
Convert models to generators and call `ddm => .reload`
```swift
private extension MainTableViewController {func fill() {
let models = ["First", "Second", "Third"]
for model in models {
let generator = TitleTableViewCell.rddm.baseGenerator(with: model)generator.didSelectEvent += { [weak self] in
// do some logic
}// Add generator to adapter
ddm.addCellGenerator(generator)
// or simple use operator `+=`
ddm += generator
}ddm => .reload
}}
```### Enjoy
As you can see, you don't need to conform `UITableViewDelegate` and `UITableViewDataSource`. This protocols are hidden inside ReactiveDataDisplayManager.
You can extend table functionality with adding plugins and replacing generator.[](https://ibb.co/mtnymrz)
You can check more examples in our [example project](/Example/) or in full [documentation](/Documentation/Entities.md).
Small [cheat sheet](/Documentation/Operations.md) table could also be usefull.## Installation
Just add ReactiveDataDisplayManager to your `Podfile` like this
```
pod 'ReactiveDataDisplayManager' ~> 7.3
```## Changelog
All notable changes to this project will be documented in [this file](./CHANGELOG.md).
## Issues
For issues, file directly in the [main ReactiveDataDisplayManager repo](https://github.com/surfstudio/ReactiveDataDisplayManager).
## Contribute
If you would like to contribute to the package (e.g. by improving the documentation, solving a bug or adding a cool new feature), please review our [contribution guide](/Documentation/ContributingGuide.md) first and send us your pull request.
You PRs are always welcome.
## License
[MIT License](LICENSE)