@@ -65,58 +65,52 @@ private extension StackCellExampleViewController {
6565 }
6666
6767 // Note that using `UITableViewCell` or `UICollectionViewCell` inside stack is not recommended, but it possible
68- adapter += Section ( header: TitleHeaderGenerator ( model: " StackView based cells " ) , footer: EmptyTableFooterGenerator ( ) ) {
69- Stack ( model: . build { vStack in
68+ adapter += TableSection ( header: TitleHeaderGenerator ( model: " StackView based cells " ) , footer: EmptyTableFooterGenerator ( ) ) {
69+ TableFactory . stack ( model: . build { vStack in
7070 vStack. background ( . solid( . rddm) )
7171 vStack. style ( . init( axis: . vertical,
7272 spacing: 8 ,
7373 alignment: . fill,
7474 distribution: . fill) )
75- } ) {
76- TitleTableViewCell . rddm. viewGenerator ( with: " 1 " , and: . nib)
77- TitleTableViewCell . rddm. viewGenerator ( with: " 2 " , and: . nib)
78- StackView . rddm. viewGenerator ( with: . build { hStack in
75+ } ) { context in
76+ context. stack ( model: . build { hStack in
7977 hStack. background ( . solid( . systemBlue) )
8078 hStack. style ( . init( axis: . horizontal,
8179 spacing: 4 ,
8280 alignment: . fill,
8381 distribution: . fillEqually) )
84-
85- hStack. children ( [
86- TitleTableViewCell . rddm. viewGenerator ( with: " 4 " , and: . nib) ,
87- TitleTableViewCell . rddm. viewGenerator ( with: " 5 " , and: . nib)
88- ] )
89- } )
90- TitleTableViewCell . rddm. viewGenerator ( with: " 3 " , and: . nib)
82+ } ) { context in
83+ context. viewNib ( type: TitleTableViewCell . self, model: " 4 " )
84+ context. viewNib ( type: TitleTableViewCell . self, model: " 5 " )
85+ }
86+ context. viewNib ( type: TitleTableViewCell . self, model: " 3 " )
9187 }
92- LabelView . rddm . tableGenerator ( with : . build { label in
88+ TableFactory . viewClass ( type : LabelView . self , model : . build { label in
9389 label. textAlignment ( . center)
9490 label. text ( . string( " Wrapped LabelView " ) )
9591 label. style ( . init( color: . systemBlue, font: . systemFont( ofSize: 16 ) ) )
96- } , and : . class )
97- TitleTableViewCell . rddm . baseGenerator ( with : " Cell outside from stack " , and : . nib)
98- Stack ( model: . build { hStack in
92+ } )
93+ TableFactory . cell ( type : TitleTableViewCell . self , model : " Cell outside from stack " , registerType : . nib)
94+ TableFactory . stack ( model: . build { hStack in
9995 hStack. background ( . solid( . systemGreen) )
10096 hStack. style ( . init( axis: . horizontal,
10197 spacing: 0 ,
10298 alignment: . fill,
10399 distribution: . fillEqually) )
104- } ) {
105- TitleTableViewCell . rddm . viewGenerator ( with : " 6 " , and : . nib )
106- StackView . rddm . viewGenerator ( with : . build { vStack in
100+ } ) { context in
101+ context . viewNib ( type : TitleTableViewCell . self , model : " 6 " )
102+ context . stack ( model : . build { vStack in
107103 vStack. background ( . solid( . systemPink) )
108104 vStack. style ( . init( axis: . vertical,
109105 spacing: 20 ,
110106 alignment: . fill,
111107 distribution: . fillEqually) )
112- vStack. children ( [
113- TitleTableViewCell . rddm. viewGenerator ( with: " 6 " , and: . nib) ,
114- TitleTableViewCell . rddm. viewGenerator ( with: " 7 " , and: . nib) ,
115- TitleTableViewCell . rddm. viewGenerator ( with: " 8 " , and: . nib) ,
116- TitleTableViewCell . rddm. viewGenerator ( with: " 9 " , and: . nib)
117- ] )
118- } ,
119- and: . class)
108+ } ) { context in
109+ context. viewNib ( type: TitleTableViewCell . self, model: " 7 " )
110+ context. viewNib ( type: TitleTableViewCell . self, model: " 8 " )
111+ context. viewNib ( type: TitleTableViewCell . self, model: " 9 " )
112+ context. viewNib ( type: TitleTableViewCell . self, model: " 10 " )
113+ }
120114 }
121115 }
122116
0 commit comments