Post

Replies

Boosts

Views

Activity

Reply to RealityView update closure
``struct CubeView: View { private var number: Int init(number: Int) { self.number = number } var body: some View { let boxSize: Float = 0.1 let cornerRadius: Float = boxSize / 10 let cubeColorTheme = CubeColorTheme.colorPair(for: number) RealityView { content in let _ = print("\t\tCreating reality view with \(number)") let boxEntity = ModelEntity( mesh: .generateBox(size: boxSize, cornerRadius: cornerRadius), materials: [ SimpleMaterial(color: UIColor(cubeColorTheme.background), isMetallic: false) ]) let textEntity = ModelEntity( mesh: MeshResource.generateText( title(), extrusionDepth: 0, font: .systemFont(ofSize: fontSize(), weight: .semibold), containerFrame: CGRect(), alignment: .center, lineBreakMode: .byCharWrapping ), materials: [ SimpleMaterial(color: UIColor(cubeColorTheme.font), isMetallic: false) ] ) textEntity.position = textPosition() boxEntity.addChild(textEntity) content.add(boxEntity) } update: { content in let _ = print("Number updated") // PRINTS FINE } }`` Here is my CubeView, which has a RealityView inside of it. I then display this on my window using the following code: VStack { ForEach(viewModel.matrix, id: \.id) { cube in CubeView(number: cube.value) } } I have some other code that changes the number on a cube (Not the ID) and for some reason the cube does not re-render with the new number _but_ the update closure gets called as expected!
Jul ’23
Reply to RealityView update closure
Hi @CryptoKoa . I am having the exact same issue! It seems like you've come to a solution, but there's one part of your solution I'm unable to grasp. What is this graph object? Could you please post a full code snippet? Context: I am also building a reality view that uses @Published variables to update its state, but when i change the @Published variables, the reality view doesn't re-render. I would greatly appreciate some help.
Jul ’23
Reply to Cannot get email & name while scopes requested on real device
Even if you delete the app and run it again, you can't have access to the familyName, givenName, email, etc. It truly is given to you ONE time. My team noticed this problem early, and even though we only launched in specific locations, we started saving information into keychain of people who were out of location. A way to test if your auth stuff works is to run your auth code on a phone you haven't plugged into simulator yet.
Jan ’22