TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

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 RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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.