title: why the autolayout is not updated if I use IBDesignable file when i run the app?
body: <p>here is the project of this problem in the google drive: <a href="https://drive.google.com/file/d/1Js0t-stoerWy8O8uIOJl_bDw-bnWAZPr/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1Js0t-stoerWy8O8uIOJl_bDw-bnWAZPr/view?usp=sharing</a></p>
  
  <p>I make a custom navigation bar (the red view in the picture below) using IBDesignable code below. I want, if the iPhone has top notch like iPhone X, iPhone XR, then the height of custom navigation bar is 88, otherwise the height is 64. I make an IBDesignable code so I can reuse this code</p>
  
  <pre><code>import UIKit
  
  @IBDesignable
  class CustomParentNavigationBarView: UIView {
  
      override func awakeFromNib() {
          super.awakeFromNib()
          self.setHeight()
      }
  
      override func layoutSubviews() {
          super.layoutSubviews()
          self.setHeight()
      }
  
      func setHeight() {
          let deviceHasTopNotch = checkHasTopNotchOrNot()
          layer.frame.size.height = deviceHasTopNotch ? 88 : 64
      }
  
      func checkHasTopNotchOrNot() -&gt; Bool {
          if #available(iOS 11.0, tvOS 11.0, *) {
              // with notch: 44.0 on iPhone X, XS, XS Max, XR.
              // without notch: 20.0 on iPhone 8 on iOS 12+.
              return UIApplication.shared.delegate?.window??.safeAreaInsets.top ?? 0 &gt; 20
          }
          return false
      }
  
  }
  </code></pre>
  
  <p>I assign this <code>CustomParentNavigationBarView</code> to the red view</p>
  
  <p><a href="https://i.stack.imgur.com/wg27v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wg27v.png" alt="enter image description here"></a></p>
  
  <p>and then, I put a label. that should located exactly below the red view (custom navigation bar, that uses IBDesignable)</p>
  
  <p>it looks great if I run the app in the iPhone doesn't have top notch like iPhone8
  <a href="https://i.stack.imgur.com/Vf68n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vf68n.png" alt="enter image description here"></a></p>
  
  <p>but, if I run the app in iPhone that has top notch like iPhone XR, the label now inside the red view, it seems still following the previous autolayout to the red view height that previously 64 (in storyboard I am using iPhone 8), so when the custom navigation bar update to 88 when it is running on iPhone XR, the label still follow the previous 64 height, then it will locate inside the red view</p>
  
  <p><a href="https://i.stack.imgur.com/GudRp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GudRp.png" alt="enter image description here"></a></p>
  
  <p>here is the autolayout of custom nav bar (red view)</p>
  
  <p><a href="https://i.stack.imgur.com/ywIDU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ywIDU.png" alt="enter image description here"></a></p>
  
  <p>and here is the autolayout of the label</p>
  
  <p><a href="https://i.stack.imgur.com/HwuZY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HwuZY.png" alt="enter image description here"></a></p>
  
  <p>how to solve this issue ?</p>