Post marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
Post marked as solved with 1 replies, 0 views
In the hideFlux function you are creating a new instance of your HostingViewController that is different from the instance you are presenting, so calling dismiss on it does nothing.
Call dismiss() on the presentedViewController, which should be the ViewController you instantiated in the showFlux method.
In general though this is a very brittle pattern. Your code should call the dismiss function from within the ViewController that is to be dismissed, so there is no ambiguity on what should be dismissed.
Also, this is basically UIKit code, if you want to do it in SwiftUI, it is all a bit different, and maybe you shouldn't need to get down to the UIKit layer in the first place.