Fatal error: Use of unimplemented initializer 'init(nibName:bundle:)' for class 'SwiftUI.UIHostingController'.

My simple UIHostingController code gives

Fatal error: Use of unimplemented initializer 'init(nibName:bundle:)' for class 'SwiftUI.UIHostingController' error.

import UIKit
import SwiftUI

struct SwiftUIView: View {
    var body: some View {
        ZStack {
          Text("annen")
            .font(.headline)
            .fontWeight(.bold)
        }
    }
}

class SwiftUIViewController: UIHostingController<SwiftUIView> {
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder, rootView: SwiftUIView())
    }
}

I don't have any other usage of UIHostingController than this code, is this a bug or my mistake?

Could you show the code where you create the SwiftUIViewController instance ?

@Claude31 sorry, didn't understand. It's just a basic class, I change its name to ShareExtensionViewController. Where can I look for this?

Fatal error: Use of unimplemented initializer 'init(nibName:bundle:)' for class 'SwiftUI.UIHostingController'.
 
 
Q