0

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)) // <----
János
  • 32,867
  • 38
  • 193
  • 353
  • Are you looking for this? https://developer.apple.com/documentation/swiftui/view/glassbackgroundeffect(displaymode:)?changes=_8 – jnpdx Jul 31 '23 at 15:01

0 Answers0