Your method is good.
I used a method where I subclassed UIHostingController and overrode its lifecycle methods to resolve the issue.
Topic:
Spatial Computing
SubTopic:
General
Tags: