How can I remove or hide this part under a SwiftUI panel? What Swift code should I write to control this?
How to hide slider bar and close button under the SwiftUI panel
It's not possible to hide the move or close button. If you are in an immersive space you can use attachments and the glassBackgroundEffect modifier to achieve something similar to a window that is not movable or closable. Here's a snippet that does that:
struct SomeView: View {
@PhysicalMetric(from: .meters)
var halfAMeter = 0.5
var body: some View {
let attachmentId = "some-attachment-id"
RealityView { content, attachments in
guard let attachment = attachments.entity(for: attachmentId) else {return}
// Position the entity as you would any other
attachment.position = [0, 1, -1]
content.add(attachment)
}
attachments: {
Attachment(id: attachmentId) {
VStack {
// Your content here
}
.frame(width: halfAMeter, height: halfAMeter)
.glassBackgroundEffect()
}
}
}
}