### Adjust Blur with Start Offset Source: https://context7.com/nikstar/variableblur/llms.txt Uses a negative startOffset to begin the blur transition from a larger radius for smoother visual results. ```swift import SwiftUI import VariableBlur struct OffsetBlurView: View { var body: some View { ZStack { // Content behind the blur Image("photo") .resizable() .aspectRatio(contentMode: .fill) } .overlay(alignment: .top) { // Start offset of -0.1 begins blur from slightly larger radius // for smoother visual appearance with certain content types VariableBlurView( maxBlurRadius: 25, direction: .blurredTopClearBottom, startOffset: -0.1 ) .frame(height: 180) } .ignoresSafeArea() } } ``` -------------------------------- ### VariableBlurView with Blurred Top Source: https://github.com/nikstar/variableblur/blob/main/README.md Use VariableBlurView to apply a progressive blur effect, with the top portion being blurred and the bottom clear. This example demonstrates its use over a ZStack with various elements. ```swift ZStack(alignment: .top) { Color.white Color.blue.opacity(0.3) Image("im") .resizable() .aspectRatio(contentMode: .fit) .padding(.horizontal, 50) Text("VariableBlur") .font(.largeTitle.monospaced().weight(.bold)) .padding(.top, 230) .foregroundStyle(.white.opacity(0.9)) } .overlay(alignment: .top) { VariableBlurView(maxBlurRadius: 20, direction: .blurredTopClearBottom) .frame(height: 200) } .ignoresSafeArea() ``` -------------------------------- ### BackgroundBlur Component Source: https://github.com/nikstar/variableblur/blob/main/README.md Utilize the BackgroundBlur component for a straightforward background blur effect. This example shows a capsule shape with a blur applied to its background. ```swift HStack(spacing: 0) { Color.blue Color.blue.opacity(0.2) } .overlay { BackgroundBlur(radius: 20) .frame(width: 200, height: 100) .clipShape(.capsule) } .ignoresSafeArea() ``` -------------------------------- ### Implement VariableBlurUIView in UIKit Source: https://context7.com/nikstar/variableblur/llms.txt Integrates a progressive blur view into a UIKit view controller by adding it as a subview. ```swift import UIKit import VariableBlur class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Add background image let imageView = UIImageView(image: UIImage(named: "background")) imageView.contentMode = .scaleAspectFill imageView.frame = view.bounds imageView.autoresizingMask = [.flexibleWidth, .flexibleHeight] view.addSubview(imageView) // Create variable blur view let blurView = VariableBlurUIView( maxBlurRadius: 20, direction: .blurredTopClearBottom, startOffset: 0 ) blurView.frame = CGRect(x: 0, y: 0, width: view.bounds.width, height: 200) blurView.autoresizingMask = [.flexibleWidth, .flexibleBottomMargin] view.addSubview(blurView) } } ``` -------------------------------- ### Create Status Bar Matching Blur Source: https://context7.com/nikstar/variableblur/llms.txt Uses GeometryReader to match the blur height to the device's safe area insets. ```swift import SwiftUI import VariableBlur struct StatusBarBlurView: View { var body: some View { ScrollView { // Your scrollable content VStack(spacing: 20) { ForEach(0..<50) { index in Text("Item \(index)") .frame(maxWidth: .infinity) .padding() .background(Color.blue.opacity(0.1)) } } } .overlay(alignment: .top) { GeometryReader { geom in VariableBlurView(maxBlurRadius: 10) .frame(height: geom.safeAreaInsets.top) .ignoresSafeArea() } } } } ``` -------------------------------- ### Implement VariableBlurView in SwiftUI Source: https://context7.com/nikstar/variableblur/llms.txt Basic usage of VariableBlurView to create a top-to-bottom progressive blur overlay. ```swift import SwiftUI import VariableBlur struct ContentView: View { var body: some View { ZStack(alignment: .top) { // Background content Color.white Color.blue.opacity(0.3) // Image that will be partially blurred Image("hero-image") .resizable() .aspectRatio(contentMode: .fit) .padding(.horizontal, 50) // Text overlay Text("Welcome") .font(.largeTitle.monospaced().weight(.bold)) .padding(.top, 230) .foregroundStyle(.white.opacity(0.9)) } .overlay(alignment: .top) { // Progressive blur overlay - blurred at top, clear at bottom VariableBlurView(maxBlurRadius: 20, direction: .blurredTopClearBottom) .frame(height: 200) } .ignoresSafeArea() } } ``` -------------------------------- ### Implement BackgroundBlurView in UIKit Source: https://context7.com/nikstar/variableblur/llms.txt Adds a uniform background blur view to a UIKit controller with programmatic radius control. ```swift import UIKit import VariableBlur class BlurViewController: UIViewController { private var blurView: BackgroundBlurView! override func viewDidLoad() { super.viewDidLoad() // Setup gradient background let gradientLayer = CAGradientLayer() gradientLayer.colors = [UIColor.systemBlue.cgColor, UIColor.systemPurple.cgColor] gradientLayer.frame = view.bounds view.layer.addSublayer(gradientLayer) // Create and add blur view blurView = BackgroundBlurView(radius: 30) blurView.frame = CGRect(x: 50, y: 200, width: 200, height: 100) blurView.layer.cornerRadius = 50 blurView.clipsToBounds = true view.addSubview(blurView) } // Programmatically adjust blur radius func updateBlurRadius(_ radius: CGFloat) { blurView.blurRadius = radius } } ``` -------------------------------- ### Configure Inverted Blur Direction Source: https://context7.com/nikstar/variableblur/llms.txt Sets the blur direction to clear-at-top and blurred-at-bottom for bottom-aligned content. ```swift import SwiftUI import VariableBlur struct BottomBlurView: View { var body: some View { ZStack(alignment: .bottom) { // Full-screen image Image("background") .resizable() .aspectRatio(contentMode: .fill) // Bottom content with upside-down blur VStack { Text("Caption") .font(.headline) .foregroundColor(.white) Text("Additional details here") .font(.subheadline) .foregroundColor(.white.opacity(0.8)) } .padding() } .overlay(alignment: .bottom) { VariableBlurView( maxBlurRadius: 15, direction: .blurredBottomClearTop ) .frame(height: 150) } .ignoresSafeArea() } } ``` -------------------------------- ### Apply BackgroundBlur in SwiftUI Source: https://context7.com/nikstar/variableblur/llms.txt Applies a uniform background blur to a view using the BackgroundBlur component. ```swift import SwiftUI import VariableBlur struct BackgroundBlurExample: View { var body: some View { HStack(spacing: 0) { // Two-tone background to demonstrate blur Color.blue Color.blue.opacity(0.2) } .overlay { // Clean background blur with capsule shape BackgroundBlur(radius: 20) .frame(width: 200, height: 100) .clipShape(.capsule) } .ignoresSafeArea() } } ``` -------------------------------- ### Configure VariableBlurDirection Source: https://context7.com/nikstar/variableblur/llms.txt Defines the orientation of the blur gradient for VariableBlurView instances. ```swift import VariableBlur // Available directions let topBlur: VariableBlurDirection = .blurredTopClearBottom // Blurred at top, clear at bottom let bottomBlur: VariableBlurDirection = .blurredBottomClearTop // Clear at top, blurred at bottom // Usage in VariableBlurView VariableBlurView(maxBlurRadius: 20, direction: .blurredTopClearBottom) VariableBlurView(maxBlurRadius: 20, direction: .blurredBottomClearTop) ``` -------------------------------- ### VariableBlurView for Safe Area Blur Source: https://github.com/nikstar/variableblur/blob/main/README.md Apply a blur effect that matches the height of the device's top safe area (e.g., status bar or cutout). This requires a GeometryReader to determine the safe area insets. ```swift ContentView() .overlay(alignment: .top) { GeometryReader { geom in VariableBlurView(maxBlurRadius: 10) .frame(height: geom.safeAreaInsets.top) .ignoresSafeArea() } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.