Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ViewFactory should be @MainActor constrainedΒ #722

Copy link
Copy link
Open
@swizzlr

Description

@swizzlr
Issue body actions

What are you trying to achieve?

I have views that depend on MainActor isolated view models. In order to initialize my views I need to retrieve these MainActor isolated dependencies that are retrieved via "@Inject" in the viewfactory. Since the viewfactory methods are nonisolated, I'm not able to access these - and if I annotate the methods as @mainactor, they do not satisfy the protocol requirements.

If possible, how can you achieve this currently?

Maybe I could try injecting them directly into the views?

What would be the better way?

Since SwiftUI Views are MainActor isolated to begin with, and the ViewFactory is invoked from Views in a MainActor isolated context, it seems reasonable to constrain the ViewFactory to MainActor

GetStream Environment

GetStream Chat version: 4.61
GetStream Chat frameworks: StreamChat, StreamChatSwiftUI
iOS version: any
Swift version: 6
Xcode version: 16.2
Device: any

Additional context

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.