You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
We'll review it internally and will get back to you. Adding a @mainactor requirement might cause a breaking change for SDK users, therefore it needs to be considered carefully.
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
The text was updated successfully, but these errors were encountered: