Have you been able to solve this? I'm facing the same issue. I want to add a gesture recognizer to the entire RealityView, but am unable.
Post
Replies
Boosts
Views
Activity
https://developer.apple.com/forums/thread/733020 It seems like this @CryptoKoa has seemed to solve this issue although I am having trouble understandind what the Graph is in his code segment, perhaps you could understand it and explain it to me ?
``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!
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.
Hey did you figure out how to detect pinch and drag gestures?
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.