This app represent the explanation of Dependency Inversion for Routing in SwiftUI
The concept of dependency inversion is maintain the isolation state of each module.
In this project you can see that the FeatureAModule doesn't know about FeatureBModule but ContentView
in FeatureAModule can route to DetailView
that available in FeatureBModule
This app consist of 3 screen
Feature A Home == ``ContentView``
Feature B Detail == ``DetailView``
Feature A AnotherDetail == ``AnotherDetailView``
-
detail
button inFeature A Home
orContentView
/ContentView/body
will route to ->Feature B Detail
orDetailView
-
detail
button inFeature B Detail
orDetailView
/DetailView/body
will route to ->Feature A AnotherDetail
orAnotherDetailView
-
back
button inFeature B Detail
just back to previous page -
button
back to detail
insideAnotherDetailView
/AnotherDetailView/body
or Feature A AnotherDetail route to -> Feature B Detail orDetailView
because the detail of Feature A Home is Feature B Detail