Since there is no support for dynamic section titles I'll open this issue.
You've stated that Results are "unsectioned" data but they have a filter options. Isn't it an idea to use the `NSPredicate` mapped to a `String` to provide a filtered results list and map it to a section title? Then the initial results set will be mapped using the `NSPredicate` and everything updates. Or am I overseeing something?
I agree that it could be done, there's a slight gotcha that if there are several changes happening over more than one sections there ought to be some code to detect that and just reload the whole table to avoid separate changes getting out of sync with the state of the table view. But it is achievable 👍
What I do now is subscribe to the results and map them dynamically to a section with RxDataSources. The problem here is that if I delete an item, I get an exception. Everything else works fine tho.
```swift
Observable.collection(from: games).map { results in
return [GameSection(header: "YOUR TURN", items: results.filter(NSPredicate(format: "turnPlayer == %@", Profile.instance.displayName)).toArray().reversed()),
GameSection(header: "OPPONENTS TURN", items: results.filter(NSPredicate(format: "turnPlayer != %@ && turnPlayer != nil", Profile.instance.displayName)).toArray().reversed()),
GameSection(header: "FINISHED", items: results.filter("turnPlayer = nil").toArray().reversed())]
}
.map { sections in
return sections.filter { section in
return section.items.count > 0
}
}
.bind(to: tableView.rx.items(dataSource: dataSource))
.disposed(by: disposeBag)
```
Is there an other better way of doing so?
I guess the exception is coming from the `.toArray()` function since there will be items in the array while they have been deleted. Some kind of race condition
Since this crash doesn't seem to be related to the current repo I'll close this issue.
I don't know what exactly is happening in your app, but instead of filtering the result set multiple times, I'd use `https://github.com/RxSwiftCommunity/RxRealm#observablearrayfromsynchronousstart` which gives you the results as an array and then use `map` to split the elements into 3 sections like you do. Maybe give that a try but I can't say more than that