I am developing a SwiftUI application for visionOS and would like to implement a glassy effect for a specific view. visionOS provides unique features and capabilities that may differ from other platforms, such as iOS or macOS.
I tried using .blur
and .background
modifiers.
Could someone with experience in visionOS development guide me on how to achieve the glassy effect in a SwiftUI app targeting visionOS? I'm interested in using the cool features that visionOS provides for creating immersive spatial experiences.
struct ContentView: View {
@EnvironmentObject var sharedState: SharedState
var body: some View {
HStack (spacing: 0){
if UIScreen.main.bounds.width >= 768 {
if sharedState.isMenuViewVisible {
MenuView().frame(minWidth: 300, maxWidth: 300)
}
} else if sharedState.selectedMenuItem == .none && UIScreen.main.bounds.width < 768 {
MenuView()
.blur(radius: 10) // <----
.background(Color.blue.opacity(0.3)) // <----