HomeiOS Developmentios - Is there a option to customise the fabric's shade mix...

ios – Is there a option to customise the fabric’s shade mix mode to realize a darker impact?


I am making an attempt to create a frosted glass impact in SwiftUI over a background picture, however the .ultraThinMaterial impact seems too white/brilliant. I wish to obtain a darker, extra refined impact like proven on this

enter image description here

However with the code under I get output like this:

enter image description here

Code:

import SwiftUI

struct ContentView: View {
    var physique: some View {
        ZStack {
            // Background picture - centered and correctly fitted
            GeometryReader { geometry in
                Picture("background")
                    .resizable()
                    .aspectRatio(contentMode: .fill)
                    .body(width: geometry.measurement.width, peak: geometry.measurement.peak)
                    .clipped()
            }
            .ignoresSafeArea()
            
            // A lot darker materials for refined impact
            Rectangle()
                .fill(.ultraThinMaterial)
                .ignoresSafeArea()
        }
    }
}

#Preview {
    ContentView()
}

Query:
How can I protect the darker tones of the background picture whereas nonetheless making use of a blur impact?

Thanks in superior!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments