title: Function of Subclass won't get called - SwiftUI
body: <p>I am currently working with SwiftUI and need to implement a UIViewController class. From this specific class (ViewController), I would like that <code>Subclass</code> inherits from it.
  My problem now is, when I am calling the function <code>setupAVCapture()</code> in the superclass, I thought that the override method in my subclass would get called first, and then the Method in the superclass when I call <code>super.setupAVCapture()</code>.
  Am I missing something?</p>
  <p>What I first did, was to implement a struct conforming to <code>UIViewControllerRepresentable</code> as follows:</p>
  <pre class="lang-swift prettyprint-override"><code>struct AVCaptureView: UIViewControllerRepresentable{
      func makeUIViewController(context: Context) -&gt; CameraViewController {
          let cameraVC = CameraViewController()
          return cameraVC
      }
      func updateUIViewController(_ uiViewController: CameraViewController, context: Context) { }
  }
  </code></pre>
  <p>This class is getting called in my ContentView body.</p>
  <p>Then the actual super class is implemented as follows:</p>
  <pre class="lang-swift prettyprint-override"><code>class ViewController: UIViewController, AVCaptureVideoDataOutputSampleBufferDelegate {
  ...
    override func viewDidLoad() {
          super.viewDidLoad()
          setupAVCapture()
    }
    func setupAVCapture {
      ...
    }
  ...
  }
  </code></pre>
  <p>Then the corresponding subclass looks something like this:</p>
  <pre class="lang-swift prettyprint-override"><code>class Subclass: ViewController {
     override func setupAVCapture() {
          super.setupAVCapture()
          ...
     }
  }
  </code></pre>
  <p>This method <code>override func setupAVCapture</code> should get called from its super class in the viewDidLoad Method. But what it does, it is calling the method in the superclass <code>func setupAVCapture()</code></p>