[Question] How group messages by Date?
Hi, I'm searching best practices for group chat messages by date. Maybe someone can help me find good solution for mapping view? In documentation i found that example:
YapDatabaseViewMappings *mappings = [YapDatabaseViewMappings mappingsWithGroups:@[ @"bond movies", @"bond actors" ] view:@"myView"];
and i have one idea its do filter by SQL request.
I believe similar questions have been asked, but I don't know that I've seen a satisfactory answer yet.
maybe similar to: https://github.com/yapstudios/YapDatabase/issues/378
And this comment: https://github.com/yapstudios/YapDatabase/issues/206#issuecomment-142866935
So you have a YapDatabaseView which groups messages by the conversationId. Now, for each conversation, you want a subgrouping of those messages (e.g. group by date).
What I want is performance akin to a UICollectionView backed by a YapDatabaseViewMapping (as well as the ability to respond to dbModified notifications), but mappings aren't really built to solve this problem.
I suppose you could register a YapDatabaseView per conversation which filters by that conversation and groups by date, but it seems weird to persist a view per conversation. And I assume building one dynamically would have untenable perf implications, due to requisite initial population of the view.
@michaelkirk I've wanted something similar to this in the past. You could probably create something like YapDatabaseSubgroupView modeled off of YapDatabaseFilteredView that takes a parent view, and allows you to dynamically filter the parent's groups and remap the objects to new subgroups. That way the mappings would only need to be aware of YapDatabaseSubgroupView date groups.