Skip to content

Commit 813f646

Browse files
committed
make common BaseCellGenerator for table and collection
1 parent 6e47615 commit 813f646

File tree

34 files changed

+98
-313
lines changed

34 files changed

+98
-313
lines changed

Components/Sources/Collection/CollectionWrappedCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import UIKit
99
import ReactiveDataDisplayManager
1010

1111
/// Empty collection cell with `View`. Configuration is implemented within `ViewWrapper`.
12-
public final class CollectionWrappedCell<View: ConfigurableItem & RegistrationTypeProvider>: UICollectionViewCell, ViewWrapper {
12+
public final class CollectionWrappedCell<View: BaseItem>: UICollectionViewCell, ViewWrapper {
1313

1414
public typealias Model = View.Model
1515

Components/Sources/Collection/DecorationProviders/CollectionDecorationProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import ReactiveDataDisplayManager
1010

1111
final class CollectionDecorationProvider<Cell: ConfigurableItem & UICollectionViewCell>: DecorationProvider where Cell.Model: Equatable {
1212

13-
typealias GeneratorType = DiffableCollectionCellGenerator<Cell>
13+
typealias GeneratorType = DiffableCellGenerator<Cell>
1414

1515
// MARK: - Properties
1616

Components/Sources/Collection/Extensions/CollectionContext+CollectionWrappedCell.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ extension CollectionContext: BuilderContext {
1414
public typealias ViewType = UICollectionViewCell
1515
public typealias GeneratorType = CollectionCellGenerator
1616

17-
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> GeneratorType where Item: ConfigurableItem,
18-
Item: RegistrationTypeProvider {
17+
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> GeneratorType where Item: BaseItem {
1918
Item.rddm.collectionGenerator(with: model)
2019
}
2120

2221
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> GeneratorType where Item: ViewType,
23-
Item: ConfigurableItem,
24-
Item: RegistrationTypeProvider {
22+
Item: BaseItem {
2523
Item.rddm.baseGenerator(with: model, and: Item.prefferedRegistration)
2624
}
2725

Components/Sources/Collection/Extensions/CollectionWrappedCell+RDDM.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import ReactiveDataDisplayManager
99
import UIKit
1010

11-
public extension StaticDataDisplayWrapper where Base: UIView & ConfigurableItem & RegistrationTypeProvider {
11+
public extension StaticDataDisplayWrapper where Base: UIView & BaseItem {
1212

13-
func collectionGenerator(with model: Base.Model) -> BaseCollectionCellGenerator<CollectionWrappedCell<Base>> {
13+
func collectionGenerator(with model: Base.Model) -> BaseCellGenerator<CollectionWrappedCell<Base>> {
1414
CollectionWrappedCell<Base>.rddm.baseGenerator(with: model,
1515
and: .class)
1616
}

Components/Sources/Table/Extensions/TableContext+TableWrappedCell.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ extension TableContext: BuilderContext {
1414
public typealias ViewType = UITableViewCell
1515
public typealias GeneratorType = TableCellGenerator
1616

17-
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> GeneratorType where Item: ConfigurableItem,
18-
Item: RegistrationTypeProvider {
17+
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> GeneratorType where Item: BaseItem {
1918
Item.rddm.tableGenerator(with: model)
2019
}
2120

22-
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> GeneratorType where Item: ViewType,
23-
Item: ConfigurableItem,
24-
Item: RegistrationTypeProvider {
21+
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> any GeneratorType where Item: ViewType,
22+
Item: BaseItem {
2523
Item.rddm.baseGenerator(with: model, and: Item.prefferedRegistration)
2624
}
2725

Components/Sources/Table/Extensions/TableWrappedCell+RDDM.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
import ReactiveDataDisplayManager
99
import UIKit
1010

11-
public extension StaticDataDisplayWrapper where Base: UIView & ConfigurableItem & RegistrationTypeProvider {
11+
public extension StaticDataDisplayWrapper where Base: UIView & BaseItem {
1212

1313
func tableGenerator(with model: Base.Model) -> BaseCellGenerator<TableWrappedCell<Base>> {
1414
TableWrappedCell<Base>.rddm.baseGenerator(with: model, and: .class)
1515
}
1616

1717
}
1818

19-
public extension StaticDataDisplayWrapper where Base: UITableViewCell & ConfigurableItem & RegistrationTypeProvider {
19+
public extension StaticDataDisplayWrapper where Base: UITableViewCell & BaseItem {
2020

2121
func tableGenerator(with model: Base.Model) -> BaseCellGenerator<Base> {
2222
Base.rddm.baseGenerator(with: model, and: Base.prefferedRegistration)

Components/Sources/Table/TableWrappedCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import UIKit
99
import ReactiveDataDisplayManager
1010

1111
/// Empty table cell with `View`. Configuration is implemented within `ViewWrapper`.
12-
public final class TableWrappedCell<View: ConfigurableItem & RegistrationTypeProvider>: UITableViewCell, ViewWrapper {
12+
public final class TableWrappedCell<View: BaseItem>: UITableViewCell, ViewWrapper {
1313

1414
public typealias Model = View.Model
1515

Example/ReactiveDataDisplayManager/Collection/DiffableCollectionViewController/DiffableCollectionViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import ReactiveDataComponents
1111
@available(iOS 13.0, *)
1212
final class DiffableCollectionViewController: UIViewController {
1313

14-
typealias DiffableGenerator = DiffableCollectionCellGenerator<TitleCollectionListCell>
14+
typealias DiffableGenerator = DiffableCellGenerator<TitleCollectionListCell>
1515

1616
// MARK: - Constants
1717

Example/ReactiveDataDisplayManager/Collection/DifferenceCollectionViewController/DifferenceCollectionViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ReactiveDataDisplayManager
99

1010
final class DifferenceCollectionViewController: UIViewController {
1111

12-
typealias DiffableGenerator = DiffableCollectionCellGenerator<TitleCollectionListCell>
12+
typealias DiffableGenerator = DiffableCellGenerator<TitleCollectionListCell>
1313

1414
// MARK: - Constants
1515

Example/ReactiveDataDisplayManager/Collection/Views/Cells/DynamicHeightViewCell/DynamicHeightTableViewCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private extension DynamicHeightTableViewCell {
5959
}
6060

6161
func makeDynamicHeightCellGenerators() -> [CollectionCellGenerator] {
62-
return makeModels().map { BaseCollectionCellGenerator<RectangleColorCollectionViewCell>(with: $0) }
62+
return makeModels().map { BaseCellGenerator<RectangleColorCollectionViewCell>(with: $0) }
6363
}
6464

6565
func makeModels() -> [UIColor] {

0 commit comments

Comments
 (0)