-
Notifications
You must be signed in to change notification settings - Fork 71
Description
@davidapgar just caught me up on a conversation that's been happening on the Kotlin side: why not get rid of ViewRegistry?
In both the Swift and Kotlin implementations, ViewRegistry is our last remaining source of runtime errors. Meanwhile, the indirection it provides is probably redundant with that already provided by having no restrictions on the workflow rendering type.
Swift already has a Screen marker interface, with a method that makes a screen responsible for instantiating its own ViewController. Isn't that enough?
- Android could just as easily have a
Screen.buildViewinterface / method. That should still work nicely with the newLayoutRunnerandViewShowRenderingcode introduced in HelloLayoutRunner, goodbyeCoordinator,BackStackEffect. #383 . - Headless workflows aren't forced to use it as their rendering type
- It'd be easy enough to use
mapRendering, or provide amapViewControllermethod
The only downside we see is that a workflow's view classes become a public concern. That doesn't seem like much of an issue for internal code.
For public code, e.g. a workflow-based library that might want to allow clients to bind its own view code and for which "default" view classes could be a wart, ViewRegistry could be revived as a tool for use within a root workflow. That's practically what's happening inside WorkflowLayout / ContainerViewController already.