SwiftUi: modal views to the custom navigation framework

After presenting a way to implement custom navigation views in a previous post , now it is time to add the support for modal views. As a demonstration of the concept, I will be showing an ImagePicker modally, using this technique. In a previous post , I have presented a simple framework for achieving navigation, covering some features that lack in the current navigation view of SwiftUI; namely visual customisation and ability to push views or unwind the stack programatically. During this post, I will be exploring even further, adding support for modal views. So to recap, this is how the NavigationStack and NavigationHost classes were looking like at the end of the previous post: final class NavigationStack: ObservableObject { @Published var viewStack: [NavigationItem] = [] @Published var currentView: NavigationItem init(_ currentView: NavigationItem ){ self.currentView = currentView } func unwind(){ ...