Skip to content

Commit 7928f44

Browse files
committed
Remove SectionInfoProtocol, close jessesquires#103
Removes the superfluous `SectionInfoProtocol` to simplify `DataSource`. There was really no need for this. If clients aren't happy with this, they can still implement their own `DataSourceProtocol` instead. - Removes `SectionInfoProtocol` - Use `Section` in `DataSource` directly Other changes: - Move `DataSourceProtocol` to its own file - Move `FetchedResultsController` to its own file
1 parent 1334b36 commit 7928f44

10 files changed

+240
-261
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ This release closes the [7.0.0 milestone](https://github.com/jessesquires/JSQDat
1212
## Breaking
1313

1414
- Converted to Swift 4.0
15+
1516
- iOS 9.0 minimum now required
17+
1618
- tvOS 10.0 minimum now required
19+
1720
- **Significant renaming refactor:** renamed all "factory" references to "config", see #73 for details and reasoning
1821
- `ReusableViewFactoryProtocol` --> `ReusableViewConfigProtocol`
1922
- `ViewFactory` --> `ReusableViewConfig`
2023
- `TitledSupplementaryViewFactory` --> `TitledSupplementaryViewConfig`
2124
- Updated function param names `cellFactory:` --> `cellConfig:`
2225
- Updated function param names `supplementaryFactory:` --> `supplementaryConfig:`
2326

27+
- Removed `SectionInfoProtocol` in favor of using a concrete `Section`. `DataSource` now references `Section` directly. (#103)
28+
2429
## New
2530

2631
- Added new `DataSourceProtocol` extension convenience method `func item(atIndexPath indexPath: IndexPath) -> Item?`.

Example/Sources/CollectionViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import JSQDataSourcesKit
2121

2222
final class CollectionViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
2323

24-
typealias Source = DataSource< Section<CellViewModel> >
24+
typealias Source = DataSource<CellViewModel>
2525
typealias CollectionCellConfig = ReusableViewConfig<CellViewModel, CollectionViewCell>
2626
typealias HeaderViewConfig = TitledSupplementaryViewConfig<CellViewModel>
2727

Example/Sources/MixedCollectionViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ enum MixedItem {
4040

4141
final class MixedCollectionViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
4242

43-
typealias Source = DataSource< Section<MixedItem> >
43+
typealias Source = DataSource<MixedItem>
4444
typealias CollectionCellConfig = ComposedCellViewConfig
4545
typealias HeaderViewConfig = TitledSupplementaryViewConfig<MixedItem>
4646

Example/Sources/TableViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import JSQDataSourcesKit
2222
final class TableViewController: UITableViewController {
2323

2424
typealias TableCellConfig = ReusableViewConfig<CellViewModel, UITableViewCell>
25-
var dataSourceProvider: DataSourceProvider<DataSource<Section<CellViewModel>>, TableCellConfig, TableCellConfig>?
25+
var dataSourceProvider: DataSourceProvider<DataSource<CellViewModel>, TableCellConfig, TableCellConfig>?
2626

2727
override func viewDidLoad() {
2828
super.viewDidLoad()
@@ -43,7 +43,7 @@ final class TableViewController: UITableViewController {
4343

4444
// ** optional editing **
4545
// if needed, enable the editing functionality on the tableView
46-
let editingController: TableEditingController<DataSource<Section<CellViewModel>>> = TableEditingController(
46+
let editingController: TableEditingController<DataSource<CellViewModel>> = TableEditingController(
4747
canEditRow: { (item, tableView, indexPath) -> Bool in
4848
return true
4949
},

JSQDataSourcesKit.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
881A92E11CB881550080BC5C /* Section.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88DCAD331CB87CB400C018AF /* Section.swift */; };
1515
881A92E31CB881550080BC5C /* TitledSupplementaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88DCAD351CB87CB400C018AF /* TitledSupplementaryView.swift */; };
1616
881A92E51CB881550080BC5C /* TitledSupplementaryViewConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88DCAD371CB87CB400C018AF /* TitledSupplementaryViewConfig.swift */; };
17+
88253C521FFAF5C20022FCA8 /* DataSourceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88253C511FFAF5C20022FCA8 /* DataSourceProtocol.swift */; };
18+
88253C541FFAF7730022FCA8 /* FetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88253C531FFAF7730022FCA8 /* FetchedResultsController.swift */; };
19+
88253C551FFAF7730022FCA8 /* FetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88253C531FFAF7730022FCA8 /* FetchedResultsController.swift */; };
20+
88253C561FFAF77B0022FCA8 /* DataSourceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88253C511FFAF5C20022FCA8 /* DataSourceProtocol.swift */; };
1721
882CA4541D1D7D48006112B9 /* BridgedFetchedResultsDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 882CA4531D1D7D48006112B9 /* BridgedFetchedResultsDelegate.swift */; };
1822
882CA4551D1D7DE1006112B9 /* BridgedFetchedResultsDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 882CA4531D1D7D48006112B9 /* BridgedFetchedResultsDelegate.swift */; };
1923
882CA4561D1D7DE1006112B9 /* DataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 888799481D0E2D1700BBCCBC /* DataSource.swift */; };
@@ -88,6 +92,8 @@
8892
/* Begin PBXFileReference section */
8993
1DD7AC5C1D86C4BC00B676A6 /* TableEditingController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableEditingController.swift; sourceTree = "<group>"; };
9094
881A92CC1CB881270080BC5C /* JSQDataSourcesKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JSQDataSourcesKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
95+
88253C511FFAF5C20022FCA8 /* DataSourceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataSourceProtocol.swift; sourceTree = "<group>"; };
96+
88253C531FFAF7730022FCA8 /* FetchedResultsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchedResultsController.swift; sourceTree = "<group>"; };
9197
882CA4531D1D7D48006112B9 /* BridgedFetchedResultsDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BridgedFetchedResultsDelegate.swift; sourceTree = "<group>"; };
9298
882CA4571D1D82E1006112B9 /* TestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestCase.swift; sourceTree = "<group>"; };
9399
882CA4591D1D957A006112B9 /* BridgedFetchedResultsDelegateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BridgedFetchedResultsDelegateTests.swift; sourceTree = "<group>"; };
@@ -177,7 +183,9 @@
177183
88C99A761CBB302600A9804A /* BridgedDataSource.swift */,
178184
882CA4531D1D7D48006112B9 /* BridgedFetchedResultsDelegate.swift */,
179185
888799481D0E2D1700BBCCBC /* DataSource.swift */,
186+
88253C511FFAF5C20022FCA8 /* DataSourceProtocol.swift */,
180187
88B80CD71CBBF62A00EDF9D5 /* DataSourceProvider.swift */,
188+
88253C531FFAF7730022FCA8 /* FetchedResultsController.swift */,
181189
88DCAD2C1CB87CB400C018AF /* FetchedResultsDelegate.swift */,
182190
88DCAD2D1CB87CB400C018AF /* Info.plist */,
183191
88DCAD2F1CB87CB400C018AF /* JSQDataSourcesKit.h */,
@@ -385,11 +393,13 @@
385393
isa = PBXSourcesBuildPhase;
386394
buildActionMask = 2147483647;
387395
files = (
396+
88253C561FFAF77B0022FCA8 /* DataSourceProtocol.swift in Sources */,
388397
881A92E11CB881550080BC5C /* Section.swift in Sources */,
389398
881A92E31CB881550080BC5C /* TitledSupplementaryView.swift in Sources */,
390399
88C99A781CBB303000A9804A /* ReusableViewConfig.swift in Sources */,
391400
88C99A791CBB303000A9804A /* BridgedDataSource.swift in Sources */,
392401
881A92E51CB881550080BC5C /* TitledSupplementaryViewConfig.swift in Sources */,
402+
88253C551FFAF7730022FCA8 /* FetchedResultsController.swift in Sources */,
393403
88B80CD91CBBF62A00EDF9D5 /* DataSourceProvider.swift in Sources */,
394404
882CA4551D1D7DE1006112B9 /* BridgedFetchedResultsDelegate.swift in Sources */,
395405
882CA4561D1D7DE1006112B9 /* DataSource.swift in Sources */,
@@ -402,6 +412,7 @@
402412
isa = PBXSourcesBuildPhase;
403413
buildActionMask = 2147483647;
404414
files = (
415+
88253C521FFAF5C20022FCA8 /* DataSourceProtocol.swift in Sources */,
405416
882CA4541D1D7D48006112B9 /* BridgedFetchedResultsDelegate.swift in Sources */,
406417
88DCAD6D1CB87CC000C018AF /* FetchedResultsDelegate.swift in Sources */,
407418
88CFFD9A1CB977A100C4E9DD /* ReusableViewConfig.swift in Sources */,
@@ -411,6 +422,7 @@
411422
88B80CD81CBBF62A00EDF9D5 /* DataSourceProvider.swift in Sources */,
412423
1DD7AC5D1D86C4BC00B676A6 /* TableEditingController.swift in Sources */,
413424
888799491D0E2D1700BBCCBC /* DataSource.swift in Sources */,
425+
88253C541FFAF7730022FCA8 /* FetchedResultsController.swift in Sources */,
414426
88DCAD781CB87CC000C018AF /* TitledSupplementaryViewConfig.swift in Sources */,
415427
);
416428
runOnlyForDeploymentPostprocessing = 0;

0 commit comments

Comments
 (0)