Sourcing
Typesafe and flexible abstraction for TableView & CollectionView DataSources written in Swift. It helps you to seperate concerns and keep ViewControllers light. By operating on data providers replacing your view implementation is easy at any time.
Documentation
Read the docs. Generated with jazzy. Hosted by GitHub Pages.
Quick Demo
Setting up your Cell by implementing ConfigurableCell
& ReuseIdentifierProviding
.
import Sourcing
class LabelCell: UITableViewCell, ConfigurableCell {
func configure(with label: String) {
textLabel?.text = label
}
}
//If the reuse identifier is the same as the class name.
extension LabelCell: ReuseIdentifierProviding {}
let labelCellConfiguration = CellConfiguration<LabelCell>()
let labelsToDispay = ArrayDataProvider(sections: [["Row 1", "Row 2"], ["Row 1", "Row 2"]])
let dataSource = TableViewDataSource(dataProvider: labelsToDispay, cellConfiguration: labelCellConfiguration)
tableView.dataSource = dataSource
//Add this to sync data changes to the table view.
let changeAnimator = TableViewChangeAnimator(tableView: tableView, dataProvider: labelsToDispay)
Requirements
- iOS 9.3+
- Xcode 10.1+
- Swift 4.2
Installation
Swift Package Manager
SPM is integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
Specify the following in your Package.swift
:
.package(url: "https://github.com/lightsprint09/Sourcing", from: "4.0.0"),
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
github "lightsprint09/Sourcing" ~> 4.0
Contributing
See CONTRIBUTING for details.
Contact
Lukas Schmidt (Mail, @lightsprint09)
License
Sourcing is released under the MIT license. See LICENSE for details.
Github
link |
Stars: 14 |
You may find interesting
Releases
😷 Removes Build Waring - 2021-01-14T14:38:53
- Removes annoying build warning when used with SPM
Convenience Release 🩹 - 2020-03-26T11:12:54
- Swift Package Manager support
- Swift 5.2 breaks a minor API, which causes a major version bump
- Registering TableViewCells is now more type safe and easy
Join & Transform🚦🚥 - 2019-01-04T11:11:58
JoinedDataProvider
which compiles multiple data provider into a single one.LazyTransformationDataProvider
to transform data provider content into other type.
Building with swift lint - 2018-02-13T07:04:19
- Fixes a build crash when building with current swift lint
Complete DataSource - 2018-08-09T15:08:47
Whats new
- Support for supplementary views.
- Support for footer texts in table views
- Observable data provider
- Splited responsibility to more objects which compose nicely together.
- Improved documentation
- More elegant APIs
Fixes deletion for TableViewDataSources - 2017-11-07T06:55:11
Lower deployment target - 2017-11-05T17:52:23
Whats new
- Sourcing can now be used on lower tvOS & watchOS system versions
- Fixes for FetchResultsDataProvider change events (thanks @terenzeyuen )
tvOS📺 & watchOS ⌚️ Support - 2017-10-02T07:15:16
What`s new
- Support for tvOS.
- Support for watchOS (only DataProvider)
- Implicitly update cells when NSFetchedResultsController performs a move operation, thanks @pkalinowski
Ready for Swift 4.0 🔮 - 2017-09-15T13:27:08
What´s new
- Swift 3.2/4.0 support and Xcode 9
ArrayDataProvider
can be initialized with allCollection
types- All TableView animations are now automatic
- Improved Documentation
- SwiftLint is now enabled & working (thanks @pkalinowski)
- Enables usage in app-extensions
- Documentation & quality improvements (thanks @terenzeyuen)
You can`t have enough type erasers 😇 - 2017-06-21T07:18:59
Whats new
- New type eraser called
AnyArrayDataProvider
which can be used as wrapper to build powerful feature like sort, filter and more on top ofArrayDataProviding
. DataProviderSwitcher
allows switching between different DataProviders dynamically by changing to a given state.- Generate section headers on demand when using CoreData and
NSFetchResultsController
Improved initializers for CollectionViewDataSource - 2017-04-05T06:08:45
This makes the more type safe initializers from CollectionViewDataSource public
Fixing first round of 2.0🐝 - 2017-03-22T09:35:26
AnyDataProvider
now forwards section heders & section index titles.
2.0 - 📦 - 2017-03-13T09:42:59
This is a huge release. So lets see whats new:
- FetchedResultsControllerDataProvider
- Merge of MultiCellDataSources and DataSources
- Improves generics
- More flexible & reusable cell configuration
- DataProvider can be modifiable
- Section header and index titles support
Move all the things⛵️ - 2017-01-11T07:16:22
This release brings support for UITableview & UICollectionViews moveItemAt
data source methods
Swift 3.0 - 2016-11-09T09:39:47
Support for Swift 3.0
Change tableviews during lifecycle - 2016-10-18T11:47:11
Swift 2.3 - 2016-09-12T11:00:53
This is the last release which targets Swift 2.3.
🔰 Section Titles and better abstractions - 2016-08-29T07:37:51
- Adds ability to provide section titles.
- Better abstraction for ArrayDataProvider
- Improves documentation
Tested!✅ - 2016-08-25T08:12:44
Improves generic constraints Adds a lot of testcases