Skip to content

Commit 6bdc528

Browse files
committed
freeze registration type for wrapped cell generator
1 parent b4311b6 commit 6bdc528

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension CollectionContext: BuilderContext {
1818

1919
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> GeneratorType where Item: ConfigurableItem,
2020
Item: RegistrationTypeProvider {
21-
Item.rddm.collectionGenerator(with: model, and: Item.prefferedRegistration)
21+
Item.rddm.collectionGenerator(with: model)
2222
}
2323

2424
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> GeneratorType where Item: ViewType,
@@ -28,19 +28,19 @@ extension CollectionContext: BuilderContext {
2828
}
2929

3030
public static func stack(model: StackView.Model) -> CollectionCellGenerator {
31-
StackView.rddm.collectionGenerator(with: model, and: .class)
31+
StackView.rddm.collectionGenerator(with: model)
3232
}
3333

3434
@available(*, deprecated, renamed: "gen", message: "Please use `gen` method and `RegistrationTypeProvider` instead")
3535
public static func viewNib<T: UIView & ConfigurableItem>(type: T.Type,
3636
model: T.Model) -> BaseCollectionCellGenerator<CollectionWrappedCell<T>> {
37-
T.rddm.collectionGenerator(with: model, and: .nib)
37+
T.rddm.collectionGenerator(with: model)
3838
}
3939

4040
@available(*, deprecated, renamed: "gen", message: "Please use `gen` method and `RegistrationTypeProvider` instead")
4141
public static func viewClass<T: UIView & ConfigurableItem>(type: T.Type,
4242
model: T.Model) -> BaseCollectionCellGenerator<CollectionWrappedCell<T>> {
43-
T.rddm.collectionGenerator(with: model, and: .class)
43+
T.rddm.collectionGenerator(with: model)
4444
}
4545

4646
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import UIKit
1010

1111
public extension StaticDataDisplayWrapper where Base: UIView & ConfigurableItem & RegistrationTypeProvider {
1212

13-
func collectionGenerator(with model: Base.Model,
14-
and registerType: RegistrationType = .nib) -> BaseCollectionCellGenerator<CollectionWrappedCell<Base>> {
13+
func collectionGenerator(with model: Base.Model) -> BaseCollectionCellGenerator<CollectionWrappedCell<Base>> {
1514
CollectionWrappedCell<Base>.rddm.baseGenerator(with: model,
16-
and: registerType)
15+
and: .class)
1716
}
1817

1918
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension TableContext: BuilderContext {
1818

1919
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> GeneratorType where Item: ConfigurableItem,
2020
Item: RegistrationTypeProvider {
21-
Item.rddm.tableGenerator(with: model, and: Item.prefferedRegistration)
21+
Item.rddm.tableGenerator(with: model)
2222
}
2323

2424
public static func gen<Item>(_ type: Item.Type, model: Item.Model) -> GeneratorType where Item: ViewType,
@@ -28,19 +28,19 @@ extension TableContext: BuilderContext {
2828
}
2929

3030
public static func stack(model: StackView.Model) -> TableCellGenerator {
31-
StackView.rddm.tableGenerator(with: model, and: .class)
31+
StackView.rddm.tableGenerator(with: model)
3232
}
3333

3434
@available(*, deprecated, renamed: "gen", message: "Please use `gen` method and `RegistrationTypeProvider` instead")
3535
public static func viewNib<T: UIView & ConfigurableItem>(type: T.Type,
3636
model: T.Model) -> BaseCellGenerator<TableWrappedCell<T>> {
37-
T.rddm.tableGenerator(with: model, and: .nib)
37+
T.rddm.tableGenerator(with: model)
3838
}
3939

4040
@available(*, deprecated, renamed: "gen", message: "Please use `gen` method and `RegistrationTypeProvider` instead")
4141
public static func viewClass<T: UIView & ConfigurableItem>(type: T.Type,
4242
model: T.Model) -> BaseCellGenerator<TableWrappedCell<T>> {
43-
T.rddm.tableGenerator(with: model, and: .class)
43+
T.rddm.tableGenerator(with: model)
4444
}
4545

4646
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import UIKit
1010

1111
public extension StaticDataDisplayWrapper where Base: UIView & ConfigurableItem & RegistrationTypeProvider {
1212

13-
func tableGenerator(with model: Base.Model,
14-
and registerType: RegistrationType = .nib) -> BaseCellGenerator<TableWrappedCell<Base>> {
13+
func tableGenerator(with model: Base.Model) -> BaseCellGenerator<TableWrappedCell<Base>> {
1514
TableWrappedCell<Base>.rddm.baseGenerator(with: model,
16-
and: registerType)
15+
and: .class)
1716
}
1817

1918
}

Example/ReactiveDataDisplayManager/Table/ComponentsOverviewTableViewController/ComponentsOverviewTableViewController.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ final class ComponentsOverviewTableViewController: UIViewController {
4545
right: 0)))
4646
}
4747

48-
private lazy var recievedMessageTimeGenerator = LabelView.rddm.tableGenerator(with: recievedMessageTimeModel, and: .class)
48+
private lazy var recievedMessageTimeGenerator = LabelView.rddm.tableGenerator(with: recievedMessageTimeModel)
4949

5050
// Sent message time
5151
private let sentTimeMessageStyle = TextStyle(color: .gray, font: .preferredFont(forTextStyle: .caption1))
@@ -61,7 +61,7 @@ final class ComponentsOverviewTableViewController: UIViewController {
6161
right: 16)))
6262
}
6363

64-
private lazy var sentMessageTimeGenerator = LabelView.rddm.tableGenerator(with: sentTimeMessageModel, and: .class)
64+
private lazy var sentMessageTimeGenerator = LabelView.rddm.tableGenerator(with: sentTimeMessageModel)
6565

6666
// Date
6767
private let dateStyle = TextStyle(color: .black, font: .preferredFont(forTextStyle: .caption1))
@@ -77,7 +77,7 @@ final class ComponentsOverviewTableViewController: UIViewController {
7777
right: 0)))
7878
}
7979

80-
private lazy var dateGenerator = LabelView.rddm.tableGenerator(with: dateModel, and: .class)
80+
private lazy var dateGenerator = LabelView.rddm.tableGenerator(with: dateModel)
8181

8282
// Sent message
8383
private let sentMessageStyle = TextStyle(color: .white,
@@ -102,7 +102,7 @@ final class ComponentsOverviewTableViewController: UIViewController {
102102
property.text(.string("Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet"))
103103
}
104104

105-
private lazy var sentMessageGenerator = MessageView.rddm.tableGenerator(with: sentMessageModel, and: .class)
105+
private lazy var sentMessageGenerator = MessageView.rddm.tableGenerator(with: sentMessageModel)
106106

107107
// Recieved message
108108
private let recievedMessageStyle = TextStyle(color: .black, font: .preferredFont(forTextStyle: .body))
@@ -137,14 +137,14 @@ final class ComponentsOverviewTableViewController: UIViewController {
137137
property.selectable(true)
138138
}
139139

140-
private lazy var recievedMessageGenerator = MessageView.rddm.tableGenerator(with: recievedMessageModel, and: .class)
140+
private lazy var recievedMessageGenerator = MessageView.rddm.tableGenerator(with: recievedMessageModel)
141141

142142
// Separator
143143

144144
private let separatorModel = SeparatorModel(size: .height(1),
145145
color: .lightGray,
146146
edgeInsets: UIEdgeInsets(top: 0, left: 32, bottom: 0, right: 32))
147-
private lazy var separatorGenerator = TableWrappedCell<SeparatorView>.rddm.baseGenerator(with: separatorModel, and: .class)
147+
private lazy var separatorGenerator = TableWrappedCell<SeparatorView>.rddm.baseGenerator(with: separatorModel)
148148

149149
// MARK: - UIViewController
150150

Example/ReactiveDataDisplayManager/Table/StackCellExampleViewController/StackCellExampleViewController.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,11 @@ private extension StackCellExampleViewController {
9393
LabelView.build(in: ctx, with: .build { label in
9494
label.textAlignment(.center)
9595
label.text(.string("Wrapped LabelView"))
96-
label.style(.init(color: .systemBlue, font: .systemFont(ofSize: 16)))
96+
label.style(.init(color: .systemBlue, font: .preferredFont(forTextStyle: .body)))
9797
})
98+
ctx.gen(TitleTableViewCell.self, model: "Cell outside from stack")
9899
// TODO: - resolve crash with neb loading
99-
// TitleTableViewCell.build(in: ctx, with: "Cell outside from stack")
100+
TitleTableViewCell.build(in: ctx, with: "Cell outside from stack")
100101
StackView.build(in: ctx, with: .build { hStack in
101102
hStack.background(.solid(.systemGreen))
102103
hStack.style(.init(axis: .horizontal,

0 commit comments

Comments
 (0)