Closed steve21124 closed 7 years ago
here is sample to do dynamic section https://gist.github.com/steve21124/f9a2338447f850344c18da83aa9d84ca
seems like still having issues in dynamically adding section "Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3692.2/UICollectionView.m:5990"
after initialization. this cause above error
let section0 = Section(ModelM.self, isEqual: { $0.identity == $1.identity }) var section0Models: [ModelM] = [] { didSet { _dataSource.update( in: section0, items: section0Models, updateMode: .partial(animated: true), completion: { print(self._dataSource.numberOfItems(in: 0)) }) } } _dataSource.add(section: section0) for _ in 0..<20 { section0Models.append(ModelM(identity: UUID().uuidString, title: String.randomEmoji())) } sectionModels.add(section0)
I am not sure if the library able to handle dynamic section or not
additional info which might fix it https://stackoverflow.com/questions/12611292/uicollectionview-assertion-failure
@steve21124 Hi, Steve DataSources has not supported add/remove section dynamically. We should improve the architecture.
Thanks. May be that can be added to readme. Not supporting dynamic section adding yet
@muukii supporting dynamic sections is really needed. when do you think it will be available?
the current code does not has dynamic section https://gist.github.com/steve21124/2b750015ab27df99474fd48bc435ab56
What do you think the best way to handle dynamic section? Like adding new sections
or any other better idea?