title: How to stop UIView from rotating, without View Controller?
body: <p>I am currently working on a Capacitor plugin, and so my control over the UIView/Controller stack is somewhat limited.  What I am trying to do is display my plugin view, underneath the Capacitor webView.  The Capacitor Plugin framework provides a <code>BridgeViewController</code>, which controls a <code>WKWebView</code> (the Capacitor webView).  <code>BridgeViewController</code> is also the <code>rootViewController</code>, and so the <code>webView</code>'s parent is just a <code>UIView</code> without a View Controller.</p>
  
  <p>I'm able to make my plugin display underneath the Capacitor webView, by doing the following:</p>
  
  <pre class="lang-swift prettyprint-override"><code>self.bridge.viewController.view.superview?.addSubview(self.myPluginViewController.view)
  self.bridge.viewController.view.superview?.bringSubviewToFront(self.webView)
  </code></pre>
  
  <p>where <code>bridge.view</code> returns the webView.  The issue however, is that <code>self.myPluginViewController</code>'s lifecycle methods no longer fire.  Unfortunately, since <code>bridge</code> is the <code>rootViewController</code>, <code>bridge.view.superview</code> has no controller.</p>
  
  <p>I've also tried:</p>
  
  <pre class="lang-swift prettyprint-override"><code>self.bridge.viewController.addChild(self.myPluginViewController)
  self.bridge.viewController.view.superview?.addSubview(self.myPluginViewController.view)
  self.bridge.viewController.view.superview?.bringSubviewToFront(self.webView)
  </code></pre>
  
  <p>but that throws a <code>UIViewControllerHierarchyInconsistency</code> error.</p>
  
  <p>Any thoughts on how I can get around this?  Is it possible to add <code>myPluginViewController</code> to <code>bridge</code> as a sibling to the webView?  Alternatively, is there a way to add <code>myPluginViewController.view</code> directly to another view, while retaining the lifecycle methods?  </p>