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