HomeiOS DevelopmentGlassEffect not utilized on button border

GlassEffect not utilized on button border


I am attempting to attain having a GlassEffectContainer with some buttons and the choose button has a crimson backside border.

My solely subject is that the glass impact is not being utilized on the background the place the border is added.

GlassEffect not utilized on button border

struct GroupedGlassBorder: View {
    
    @State var chosen: Int = 1
    
    var physique: some View {
        GlassEffectContainer {
            HStack {
                BorderButton(title: "One", num: 1, chosen: $chosen)
                BorderButton(title: "Two", num: 2, chosen: $chosen)
                BorderButton(title: "Three", num: 3, chosen: $chosen)
            }
        }
        .glassEffect()

    }
}

struct BorderButton: View {
    
    var title: String
    var num: Int
    
    @Binding var chosen: Int
    
    var physique: some View {
        Button {
            self.chosen = num
        } label: {
            Textual content(title)
                .padding(12)
        }
        .background(alignment: .backside) {
            Capsule()
                .body(peak: 2)
                .foregroundStyle(chosen == num ? .crimson : .clear)
        }
        
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments