我正在尝试将 Apple 的一个演示中的 ViewController 包装在 SwiftUI UIViewControllerRepresentable 中,它有一组 IBOutlets,它们连接到主故事板。我该如何处理这种情况?应该将 IBOutlets 替换为 View 结构,还是应该尝试将 Storyboard 与 SwiftUI 合并?
struct ARViewContainer: UIViewControllerRepresentable {
@ObservedObject var model: Model
typealias UIViewControllerType = ARView
func makeUIViewController(context: Context) -> ARView {
return ARView(model)
}
func updateUIViewController(_ uiViewController:
ARViewContainer.UIViewControllerType,context:
UIViewControllerRepresentableContext<ARViewContainer>) { }
}
class ARView: UIViewController,ARSCNViewDelegate {
@ObservedObject var model: Model
// MARK: IBOutlets
@IBOutlet var sceneView: VirtualObjectARView!
@IBOutlet weak var addObjectButton: UIButton!
@IBOutlet weak var blurView: UIVisualEffectView!
@IBOutlet weak var spinner: uiactivityIndicatorView!
@IBOutlet weak var upperControlsView: UIView!