English 中文(简体)
协调员没有为国际律师联合会的意见开展工作?
原标题:Coordinator is not working for UIViewRepresentable?

也许我不理解《国际调查意见》是正确的,但我认为这将奏效。

我试图使用两门“情报调查”的课堂,以显示我在“快速情报调查”上的片面。 我也为这些班级使用两个协调员方法,各一个。 协调员可以接触到目前现场的提供和物理世界方法。

参与者在第一场和与敌方接触时,先到第二场。 Here is where the problemstarts, it doesn Let the second Coordinatorprocess 2. 采用世界和为第二类提供方法。

我认为,这是因为我仍然迅速使用第一类,而不是即使情况发生变化的第二类。 或者说,我改变了景象,但不是使用那类。

www.un.org/Depts/DGACM/index_spanish.htm 问题: 我如何能够从头等到第二课和(或)从第一场向另一场过渡,并且仍然有协调员积极工作。

这里是一等。

struct FirstClass : UIViewRepresentable {

    var view = SCNView()
    var scene = SCNScene(named: "First.scn")!

    func makeCoordinator() -> Coordinator {
        Coordinator(self)
    }

    func makeUIView(context: Context) -> SCNView {
        scene.physicsWorld.contactDelegate = context.coordinator
        view.delegate = context.coordinator
        return view
    }

    ...

    /// Transitions into the second scene.
    func changeScenes() {
        controlManager.jumped = false
        let transition = SKTransition.fade(with: .black, duration: 0.5)
        let secondClass = SecondClass()
         view.present(secondClass.scene, with: transition, incomingPointOfView: nil)
    }
}

这里是第二年级

struct SecondClass : UIViewRepresentable {

    var view = SCNView()
    var scene = SCNScene(named: "Second.scn")!

    func makeCoordinator() -> SecondCoordinator {
        SecondCoordinator(self)
    }

    func makeUIView(context: Context) -> SCNView {
        scene.physicsWorld.contactDelegate = context.coordinator
        view.delegate = context.coordinator
        return view
    }
}

这里是“快速倡议”级

struct Game: View {

    var view = FirstClass()

    var body: some View {
        ZStack {
            view
            
            ...
        }
    }
}
问题回答

这一部分<代码>第二册Class = 第二册赢得了t work,因为迅速 国际不动产业联合会不了解 SecondClas,以便妥善管理其生命周期。 更有甚者,您似乎没有使用<代码>view property of the SecondClass 座标(btw, 有趣的名称:)

一种解决办法是在同一个<条码>内管理两种情况,即:可解释的,基本上把生命周期管理放在同一个方面。

struct MyScene : UIViewRepresentable {

    var view = SCNView()
    var firstScene = SCNScene(named: "First.scn")!
    lazy var secondScene = SCNScene(named: "Second.scn")!

    ...

    /// Transitions into the second scene.
    func changeScenes() {
        controlManager.jumped = false
        let transition = SKTransition.fade(with: .black, duration: 0.5)
        view.present(secondScene, with: transition, incomingPointOfView: nil)
    }
}

Coordinator in UIViewRepresentable is to be used like delegate. You are not only write:

func makeCoordinator() -> Coordinator {
    Coordinator(self)
}

Declare your Coordinator and make conformance you need. Don t forget to attach delegate in makeUIView:

myView.delegate = context.coordinator 




相关问题
SwiftUI: How do I position a button x points above a sheet?

I am trying to recreate a Maps-style UI with a persistent bottom sheet and controls fixed above. Apple Maps UI with controls above ☝️ Example here, the "Look Around" binoculars button and ...

BraintreeDropIn deprecated functions error

I m getting this error on the latest release of BraintreeDropIn, I really don t get it since based on the patch notes, this should ve been addressed already, I have already tried cleaning derived data,...

how to limit zoom level in map swift ui?

how to limit zoom level in map swift ui i have map and need to make zoom level limited Map(coordinateRegion: $region,annotationItems: viewModel.nearbyGyms) { item in ...

UIImageView - How to get the file name of the image assigned?

Is it possible to read the name of an UIImageView s UIImage that s presently stored in the UIImageView? I was hoping you could do something kind of like this, but haven t figured it out. NSString *...

热门标签