Yesterday, somebody asked me how to do conditional navigation in SketchFlow. Out of the box, there is no built-in behavior to do conditional navigation, but the good news is that it is not hard to write one. Here is an example for how to do it.
There are many different ways of doing it. For this sample, it works like this:
- There are two behaviors: SetNavigationTarget and ConditionalNavigation
- SetNavigationTarget takes one property that you set to the display name of the screen you want to navigate to the next time ConditionalNavigation is triggered. You can have as many of these behaviors as you want across your screen – the last one triggered wins.
- ConditionalNavigation navigates to the screen set by the last triggered SetNavigationTarget behavior.
Before I explain the code, here is a screenshot of a minimal sample app using them: