LAST CHANCE: Save 50% on all my Swift books and bundles! >>

Day 20 - Cannot achieve the background material vibrancy effect

Forums > 100 Days of SwiftUI

Hi all, I'm following the Day 20 - Colors and Frames tutorial and tried to make the blurry view with foreground vibrancy enabled. According to the tutorial, we can just change the modifier .foregroundColor(.secondary) to .foregroundStyle(.secondary) to get the text vibrancy effect, so I have this:

var body: some View {
    ZStack {
        VStack(spacing: 0) {
            Color.red
            Color.blue
        }

        Text("Your content")
            .foregroundStyle(.secondary)
            .padding(50)
            .background(.ultraThinMaterial)
    }
    .ignoresSafeArea()
}

But I'm not observing any changes like what was shown in the video and the text is still completely opaque. Any idea why is that? Did Apple change the API?

P.S. my result: https://imgur.com/a/qftqNKD

3      

I think you might have to zoom in 400 percent to see the subtle difference. You can probably try .foregroundStyle(.opacity(0.01) to maybe get the desired effect.

3      

Hacking with Swift is sponsored by Essential Developer.

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until July 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.