title: Strong references and UIView memory issues
body: <p>I'm dealing with some deallocation issue and perhaps strong or circular referencing  that can't figure out. I have three <code>UIView</code>s instantiating like below:</p>
  
  <p>There is one main <code>ViewController</code> which I have added a <code>UIView</code> inside it in storyboard and the <code>UIView</code> has a <code>weak</code> outlet inside the class like: </p>
  
  <pre><code>class ViewController : UIViewController {
  
      //MARK: - outlets
      @IBOutlet weak var firstView: FirstUiview!
  
  } 
  </code></pre>
  
  <p>second <code>UIView</code> is added as a subview to the first view programmatically like: </p>
  
  <pre><code>class FirstUiview : UIView { 
  
          //creating an instance of secondUiView 
          lazy var mySecondView: SecondViewClass = {
            let dv = SecondViewClass()
            dv.backgroundColor = UIColor.red
            return dv
          }()
  
  
          //sometime later by clicking on a button 
          self.addSubview(mySecondView)
  
          //a button will be tapped to remove mySecondView; 
          //later will be called at some point upon tapping:
  
         func removingSecondViewByTapping()  {
           if mySecondView.isDescendant(of: self) {
             mySecondView.removeFromSuperview()
          }
         }
  
  } 
  </code></pre>
  
  <p>Now the <code>SecondViewClass</code> is : </p>
  
  <pre><code>class SecondViewClass : UIView { 
  
        //in this class I create bunch of uiview objects like below: 
        lazy var aView : UIView = {
          let hl = UIView()
          hl.tag = 0
          hl.backgroundColor = UIColor.lightGray
          return hl
        }()
  
        self.addSubview(aView) //... this goes on and I add other similar views the same way.
  
          //creating an instance of thirdView
          var let thirdView = UIView() 
          self.addSubview(thirdView)
  
  } 
  </code></pre>
  
  <p>Now if user taps the button to remove <code>mySecondView</code> and then add it again at some other time (still in the same <code>ViewController</code>) I expect all the subviews of <code>mySecondView</code> to have been released and gone but they are all there. I would appreciate it a lot if someone can point it to me where am I keeping a strong reference or if there is a circular referencing issue? or perhaps something else? </p>