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
Is your feature request related to a problem? Please describe.
As a user, I want to load two plugins - PluginXYZ and PluginABC.
Let's say PluginABC, sets an environment object for the player view. Example:
player.hooks?.view.tap(name: "SwiftUI-environment", { view in
AnyView(
view
.environmentObject(environment)
)
})
If I register my plugins in the order:
PluginXYZ
PluginABC
Then its possible that there is a crash when a capability is relying on PluginXYZ but uses the environment object set in PluginABC.
Describe the solution you'd like
Suggestion by @hborawski:
In order to prevent this, we could introduce a SwiftUIPlugin protocol that extends NativePlugin and adds an additional function that builds on top of SwiftUI's transformEnvironment
This would allow plugins like PluginABC to register a handler that sets up the environment, and then SwiftUIPlayer can apply all the environment modifications at once, rather than it being done per plugin, wrapping the view. This would remove this implicit dependency between the two plugins and ensure that all the environment modifications are done wrapping around the root view
Additional context
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
As a user, I want to load two plugins -
PluginXYZ
andPluginABC
.Let's say
PluginABC
, sets an environment object for the player view. Example:If I register my plugins in the order:
PluginXYZ
PluginABC
Then its possible that there is a crash when a capability is relying on
PluginXYZ
but uses the environment object set inPluginABC
.Describe the solution you'd like
Suggestion by @hborawski:
In order to prevent this, we could introduce a
SwiftUIPlugin
protocol that extends NativePlugin and adds an additional function that builds on top of SwiftUI's transformEnvironmentThis would allow plugins like
PluginABC
to register a handler that sets up the environment, and thenSwiftUIPlayer
can apply all the environment modifications at once, rather than it being done per plugin, wrapping the view. This would remove this implicit dependency between the two plugins and ensure that all the environment modifications are done wrapping around the root viewAdditional context
The text was updated successfully, but these errors were encountered: