Transparent Blur Effect of SwiftUI 5 Tutorial (iOS 17 Xcode 15 wwdc23)

1. Practical needs

Transparent Blur Effect transparent blur effect

2. The value and harvest of this article

After reading this article, you will be able to make the following interface

Please add a picture description


3. Code analysis

1. home view

import SwiftUI

struct Home: View {
    /// View Properties
    @State private var activePic: String = "Pic"
    @State private var blurType: BlurType = .freeStyle
    var body: some View {
        GeometryReader {
            let safeArea = $0.safeAreaInsets
            
            ScrollView(.vertical) {
                VStack(spacing: 15) {
                    TransparentBlurView(removeAllFilters: true)
                        .blur(radius: 15, opaque: blurType == .clipped)
                        .padding([.horizontal, .top], -30)
                        .frame(height: 100 + safeArea.top)
          

Guess you like

Origin blog.csdn.net/iCloudEnd/article/details/131370697