I'm trying to create a UIViewControllerRepresentable
struct, but Xcode keeps complaining about implementing stubs
struct PassVC: UIViewControllerRepresentable {
typealias UIViewControllerType = UIViewController
func makeUIViewController(context: Context) -> UIViewController {
let vc = UIViewController()
vc.view.backgroundColor = .yellow
return vc
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
}
}
I added the typealias first, I typed it by hand, I let Xcode implement stubs, I typed them by hand, but all attempts end up with Xcode complaining about not implementing stubs. If I click fix, it complains about redeclaration of the stub methods. Any one faced the same issue in Xcode? my Xcode version is 16.0.
The problem was that there was a custom struct with the name Context, which conflicted with the Context type required by UIViewControllerRepresentable methods. Changing the struct name solved the problem.