Skip to content

Commit 6e47615

Browse files
committed
resolve generic in extension for ConfigurableItem
1 parent 3e1bef7 commit 6e47615

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Components/Sources/Common/Extensions/ConfigurableItem+BuilderContext.swift

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

1111
public extension ConfigurableItem where Self: RegistrationTypeProvider {
1212

13-
static func build<Context: BuilderContext>(in ctx: Context.Type, with model: Model) -> Context.GeneratorType {
13+
static func build(in ctx: ViewContext.Type, with model: Model) -> ViewContext.GeneratorType {
14+
ctx.gen(Self.self, model: model)
15+
}
16+
17+
static func build(in ctx: TableContext.Type, with model: Model) -> TableContext.GeneratorType where Self: UITableViewCell {
18+
ctx.gen(Self.self, model: model)
19+
}
20+
21+
static func build(in ctx: TableContext.Type, with model: Model) -> TableContext.GeneratorType {
22+
ctx.gen(Self.self, model: model)
23+
}
24+
25+
static func build(in ctx: TableContext.Type, with model: Model) -> TableContext.GeneratorType where Self: UICollectionViewCell {
26+
ctx.gen(Self.self, model: model)
27+
}
28+
29+
static func build(in ctx: CollectionContext.Type, with model: Model) -> CollectionContext.GeneratorType {
1430
ctx.gen(Self.self, model: model)
1531
}
1632

Example/ReactiveDataDisplayManager/Table/StackCellExampleViewController/StackCellExampleViewController.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ private extension StackCellExampleViewController {
9595
label.text(.string("Wrapped LabelView"))
9696
label.style(.init(color: .systemBlue, font: .preferredFont(forTextStyle: .body)))
9797
})
98-
ctx.gen(TitleTableViewCell.self, model: "Cell outside from stack")
99-
// TODO: - crash is fixed but we got `TableWrappedCell<TitleTableViewCell> which is not correct`
10098
TitleTableViewCell.build(in: ctx, with: "Cell outside from stack")
10199
StackView.build(in: ctx, with: .build { hStack in
102100
hStack.background(.solid(.systemGreen))

0 commit comments

Comments
 (0)