FlineDev / Imperio

Keep the screen flow and data handling logic out of your view controllers – let them handle view-stuff only.
MIT License
58 stars 12 forks source link

Add multiple sub flow controllers? #10

Open markkrenek opened 6 years ago

markkrenek commented 6 years ago

Do you support multiple sub flow controllers, for example, maybe useful in the case of a tab bar.

add(subFlowController: FlowController) can be called multiple times, but it releases the previous controller. Therefore, there can only be one sub.

fredpi commented 6 years ago

As I see it, the core question about such a feature is how one interprets the add(subFlowController: FlowController) method:

  1. Either without any semantics, just as a needed burden to keep flow controllers referenced and to thereby avoid releasing.
  2. Or, considering that Imperio can be seen as a shift from the UIView& UIViewController pattern to a UIViewController & FlowController pattern, with the semantics of a flow controller acting like a node, just as a TabBarController acts as a UIViewController node.

Semantically (according to the second interpretation) it would definitely make sense to have such a feature. If you only see the method as a way to stop ARC from releasing (in-line with the first interpretation), one could argue that a "tab flow controller" is a special case and should be handled by custom release management (storing as properties).

Considering the analogy between the roles of a FlowController and UIViewController in their respective architecture, I tend to interpret the method more semantically, so I'd be in favour of such a feature.