title: Embedding UIContainerView into table view and trying to access via @IBOutlet results in Unexpectedly found nil
body: <p>Using <a href="https://developer.apple.com/library/archive/referencelibrary/GettingStarted/DevelopiOSAppsSwift/index.html#//apple_ref/doc/uid/TP40015214-CH2-SW1" rel="nofollow noreferrer">Apple's rather old Swift Getting Started</a> tutorial as a base, I've a working app. I'd like to add a UIView at the top of a table, to appear temporarily if an error occurs. Unfortunately, when trying to access UI elements from the UIView's associated class, I get an "Unexpectedly found nil while implicitly unwrapping an Optional value" error.</p>
  
  <p><a href="https://imgur.com/wfqFach.png" rel="nofollow noreferrer">https://imgur.com/wfqFach.png</a></p>
  
  <p>This is actually a UIContainerView, but apparently appears as a UIView.</p>
  
  <p>I've subclassed both the <a href="https://i.imgur.com/ssO29WJ.png" rel="nofollow noreferrer">UIView</a> and the <a href="https://i.imgur.com/ZGrSV7C.png" rel="nofollow noreferrer">linked view</a> (via an embed segue) with a subclass I called ErrorView, and added an @IBOutlet link to the UIView in the table view's subclass. The UI elements are linked to the ErrorView class with an @IBOutlet. </p>
  
  <p>When accessing ErrorView class members via the @IBOutlet in the table subclass, everything is dandy until the ErrorView class tries to access its @IBOutlet linked elements, at which point it crashes with "Unexpectedly found nil while implicitly unwrapping an Optional value."</p>
  
  <p>Strangely, accessing the view itself from within the Error Class is possible, and as such I'm able to do something view-related like change its colour without an error - though the colour change doesn't actually happen. </p>
  
  <p>A very trimmed down version of the code is below, which should reproduce the issue.</p>
  
  <p>I'm using iOS13 and Xcode 11 beta.</p>
  
  <p>ErrorView.swift</p>
  
  <pre class="lang-swift prettyprint-override"><code>import UIKit
  
  class ErrorView: UIView {
  
      override init(frame: CGRect) {
          super.init(frame: frame)
      }
      required init?(coder: NSCoder) {
          super.init(coder: coder)
      }
  
      @IBOutlet weak var uiMessage: UILabel!
  
      func setErrorMessage(errorMessage: String){
           uiMessage.text=errorMessage       //&lt;-- error here
      }
  }
  </code></pre>
  
  <p>ModuleTableViewController</p>
  
  <pre class="lang-swift prettyprint-override"><code>import UIKit
  import Foundation
  
  class ModuleTableViewController: UITableViewController {
   @IBOutlet weak var errorView: ErrorView!
  
      override func viewWillAppear(_ animated: Bool) {
          super.viewWillAppear(animated)
          errorView.setErrorMessage(errorMessage: "Hello")
      }
  }
  
  
  </code></pre>