You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This SectionModelType protocol has the following initializer as one of it's requirements:
init(original: Self, items: [Item])
In addition, the same protocol enforces var items: [Item] { get }. We can now initialize the items array backing variable (in above mentioned init) with either from original.items, or items passed as init parameter. This is very confusing. The SectionModelType code has no comments.
How section of README which explains creation of sections for this very case, talks about creating typealias (for associated value), and the items array, but not a word about following implementation of init with original: Self :
While this can work in a struct, doing the same in a class shouts:
Cannot assign to value: 'self' is immutable
Can anyone here explain what is happening here and why do we NEED to init with Self
Lastly, is there another (cleaner) way to reactively (in RXSwift / RxCocoa only) bind a sectioned table view to an observable datasource.
e.g.
my cells, and sections have their own data model, which need to be mutable (hence classes)
there are multiple screens with this requirement for different entities, so i would be interesetd in achieving this with protocols instead, and slap the corresponding data model with the protocol ans have a common implementation for RXBinding
Any pointers to either get clarity more on existing implementation, or achieving above points would be really helpful.
The text was updated successfully, but these errors were encountered:
I posted this on StackOverflow first, but I assume, this community should be able to help me better / faster in this case.
Binding a sectioned table with RxDataSources using a TableViewSectionedDataSource, requires sections which conform to SectionModelType.
This SectionModelType protocol has the following initializer as one of it's requirements:
In addition, the same protocol enforces
var items: [Item] { get }
. We can now initialize the items array backing variable (in above mentionedinit
) with either fromoriginal.items
, oritems
passed as init parameter. This is very confusing. The SectionModelType code has no comments.How section of README which explains creation of sections for this very case, talks about creating typealias (for associated value), and the items array, but not a word about following implementation of
init
withoriginal: Self
:While this can work in a struct, doing the same in a class shouts:
Can anyone here explain what is happening here and why do we NEED to init with
Self
Lastly, is there another (cleaner) way to reactively (in RXSwift / RxCocoa only) bind a sectioned table view to an observable datasource.
e.g.
Any pointers to either get clarity more on existing implementation, or achieving above points would be really helpful.
The text was updated successfully, but these errors were encountered: