CometChatCore and owns fetching, paging, real-time SDK
listeners and the Kit’s events. Both toolkits use the same store. Stores are @MainActor and @Observable.
Creating and Providing a Store
By default each component creates its own store. To configure it, create it yourself and pass it in.- SwiftUI
- UIKit
State Observation
A store publishes its screen state as an enum. For Conversations:UsersState, GroupsState and the others follow the same shape.
- SwiftUI
- UIKit
The store is
@Observable, so a view that reads store.state updates with it:Configuring Data Fetching
Pass a request builder to control what the component fetches.- SwiftUI
- UIKit
A closure that returns a fresh builder — it is called for every fetch:
List Operations
The Users and Groups stores offer these list operations:- UIKit
ConversationsStore itself offers refresh(), loadMore(), delete(_:), scrollToTop() and
sdkConversation(for:). The list never filters itself: search opens
CometChatSearch.
Store Methods
- SwiftUI
- UIKit
A SwiftUI view is a value, so call methods on the store you passed in:
Changing a Store’s Behaviour
The list stores arepublic, not open: from your app you change their behaviour through
their policy and properties rather than by subclassing — see
Policies instead of overrides.
The satellite stores CometChatThreadHeaderStore, CometChatFlagMessageStore and
CometChatMessageInformationStore are open.
Seeded Stores for Previews and Tests
Every store hasinit(seeded:): it renders the state you give it and performs no fetching,
so a preview or test needs no session.
- SwiftUI
- UIKit
Lifecycle Callbacks
- SwiftUI
- UIKit
Related
- Customization Overview — the layers and the policies.
- Events & Callbacks — taps and the Kit’s events.