Note: When I talk about App Backend I do not mean Server backend. The App backend is part of the app. It is the non-ui part of the app.
I have a code design question. Using j2objc Java is used as backend of an iOS app, where the frontend is still Objective-C.
Which part (front end or backend) should control navigation in this model?
Consider the following. The initial ViewController has been loaded. The user tapped on a button. Here are two possible cases:
the front end receives the gesture and opens the requested ViewController
the front end receives the gesture and reports the action to the Java backend. The Java backend decides which page to open next and tells the front end which ViewController is to be revealed.
To me the second solution seems to make more sense in turns of code separation. But there is one problem which occurred to me. Assume you have the following ViewController structure in your app:
- Startpage :
UIViewController
Main:UINavigationViewController
- > Main-TabPage1:
UIPageViewController
- > Main-TabPage2:
UIPageViewController
- > Main-TabPage3:
UIPageViewController
Settings:UIViewController
If you navigate on the to level of the app it is simple. You just tell the front end open Startpage, Main or Settings. But, what of the use tapped a button to go to Main > Main-TabPage3 from a Startpage or from Main > Main-TabPage1. You have to do the following:
- in case you are on Startpage: you have to tell the Front end that it should review Main and then Main TabPage3.
- in case you are on Main > Main-TabPage1: you have to tell the Front end that it should just reveal Main-TabPage3.
You see that event for such a simple page scheme revealing a ViewController fron the Java back end seems to have a lot of cases to consider.
Is this a valid way of revealing views from a Java back end or do you see any better way of doing it?