title: Is UIView superview property weak or strong?
body: <p>The UIView header states that superview property is strong</p>
  
  <pre><code>open var superview: UIView? { get }
  </code></pre>
  
  <p>But it behaves just like a weak property, i.e. if I create view1 and view2 and then call view1.addSubview(view2), and then save a strong ref to view2 only (not to view1), view1 will be deinited even though view2 references it through its superview property.</p>
  
  <p>So, I wonder how it is implemented in reality.</p>
  
  <p><strong>Edit</strong>: for example, this code prints "deinit" (the ViewController instance is shown on the screen), which means that <code>view1</code> is deinited, even though <code>view2</code> should hold it strongly through the <code>superview</code> property.</p>
  
  <pre><code>class View: UIView {
      deinit {
          print("deinit")
      }
  }
  
  class ViewController: UIViewController {
  
      var view2 = UIView()
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          let view1 = View()
          view1.addSubview(view2)
      }
  }
  </code></pre>