Hi, If you write the sample code for the gesture in the following document and try to execute it, an error will occur. https://developer.apple.com/documentation/visionos/adding-3d-content-to-your-app
Value of type '(@escaping (TapGesture.Value) -> Void) -> _EndedGesture<TapGesture>' has no member 'targetedToAnyEntity'
Is something missing?
XCode 15.0 beta 2 (15A516b) visionOS 1.0 beta
import SwiftUI
import RealityKit
import RealityKitContent
struct SphereSecondView: View
{
@State var scale = false
/*var tap: some Gesture {
TapGesture()
.onEnded { _ in
print("Tap")
scale.toggle()
}
}*/
var body: some View {
RealityView {content in
let model = ModelEntity(
mesh: .generateSphere(radius: 0.1),
materials: [SimpleMaterial(color: .yellow, isMetallic: true)])
content.add(model)
} update: { content in
if let model = content.entities.first {
model.transform.scale = scale ? [2.0, 2.0, 2.0] : [1.0, 1.0, 1.0]
}
}
.gesture(TapGesture().onEnded
.targetedToAnyEntity() { _ in
scale.toggle()
})
}
}
#Preview{
SphereSecondView()
}
Best regards.
Sadao Tokuyama
https://1planet.co.jp/
https://twitter.com/tokufxug