A lightweight, App Store-safe SwiftUI library for GPU-accelerated blurs, masks, backdrop effects, and physics-based liquid distortion.
AemiSDR works seamlessly with ScrollView and dynamic content, providing high-performance effects through a modifier-based API.
- Variable Blur: Gradient-driven blur with rounded rectangle and superellipse shapes (iOS)
- Alpha Masks: Fade content edges with configurable mask shapes (iOS)
- Backdrop Blur: Customizable backdrop blur with tint, saturation, and system material presets (iOS + macOS)
- Liquid Background: Physics-based refraction with chromatic aberration and Sellmeier dispersion (iOS)
- Display Corner Radius: Retrieve the device's actual screen corner radius (iOS)
- Optimized: Metal shaders compiled automatically via SPM build plugin, with result caching and zero-copy texture bridging
- iOS 14+ / macOS 11+
- Swift 6.2 Toolchain
- SwiftUI
Add the package in Xcode (File → Add Package Dependencies…) using the repository URL, or add it to your Package.swift:
.dependencies = [
.package(url: "https://github.com/Aemi-Studio/AemiSDR.git", branch: "main")
]Combine blurs and masks to fade the edges of a ScrollView:
import SwiftUI
import AemiSDR
struct ContentView: View {
var body: some View {
ScrollView {
// your content
}
.roundedRectMask()
.verticalEdgeMask(height: 32)
.roundedRectBlur()
.verticalEdgeBlur(height: 48, maxBlurRadius: 5)
}
}Text("Hello")
.padding()
.frostedBackdropBackground(blurRadius: 20, tintOpacity: 0.15)// Use a system material preset
BackdropBlurView(configuration: .ultraThinMaterial)
// Or customize fully
Text("Overlay")
.padding()
.backdropBlurBackground(blurRadius: 25, colorTint: .blue, colorTintAlpha: 0.1)VStack {
// your content
}
.padding()
.liquidBackground(
.regular,
shape: RoundedRectangle(cornerRadius: 24, style: .continuous)
)Or use the shorthand modifier:
ScrollView {
// content
}
.liquidBackground(
.subtle,
shape: Capsule(style: .continuous),
ignoreSafeArea: false
)| Modifier | Description |
|---|---|
roundedRectBlur(...) |
Overlay blur shaped as a rounded rectangle or superellipse |
verticalEdgeBlur(...) |
Blur applied to the top and/or bottom edges of a view |
| Modifier | Description |
|---|---|
roundedRectMask(...) |
Alpha mask shaped as a rounded rectangle or superellipse |
verticalEdgeMask(...) |
Alpha mask for vertical edges, ideal for scroll views |
| Modifier | Description |
|---|---|
backdropBlurBackground(...) |
Customizable blur as a background layer |
backdropBlurOverlay(...) |
Customizable blur as an overlay layer |
frostedBackdropBackground(...) |
Convenience frosted blur effect |
tintedBackdropBackground(...) |
Colored blur background |
Configuration-based API with system presets:
// System presets (iOS): .light, .dark, .extraLight, .ultraThinMaterial,
// .thinMaterial, .material, .thickMaterial, .chromeMaterial
BackdropBlurView(configuration: .material)
// Custom configuration
var config = BackdropBlurConfiguration()
config.blurRadius = 20
config.saturationDeltaFactor = 1.8
config.colorTint = .blue
config.colorTintAlpha = 0.1
BackdropBlurView(configuration: config)| Modifier | Description |
|---|---|
liquid(...) |
Shorthand for applying liquid glass as a background |
liquidBackground(...) |
Applies liquid glass as a background layer |
liquidOverlay(...) |
Applies liquid glass as an overlay layer |
Key configuration options:
- Materials:
.crownGlass,.flintGlass,.water,.acrylic,.diamond— each with physically-based Sellmeier dispersion coefficients - Falloff curves:
.linear,.easeIn,.easeOut,.easeInOut,.cubic,.exponential - Corner radius:
.proportional(Float)or.points(Float)when you need explicit overrides - Clip shapes: Any SwiftUI
Shape(iOS 16+) with automatic corner-radius inference viaMirror
// Static accessor
let radius = UIScreen.displayCornerRadius
// From a specific view context
let radius = myView.screenCornerRadiusAll modifiers come with sensible defaults and can be customized for corner style, transition smoothness, and more.
A full demo app is included in Examples/AemiSDRDemo/ with tabbed views showcasing each effect:
- Blur: Variable blur configurations
- Mask: Alpha mask examples
- Glass: Backdrop blur presets and custom blurs
- Liquid: Liquid background surface controls
For Xcode development with both the package and demo app in one window, open AemiSDR.xcworkspace at the repository root.
The Metal shader source files are located in Sources/AemiSDR/Shaders/. The package uses a Swift Package Manager build plugin that automatically compiles shaders during the build process.
When you build the package (via swift build or Xcode), the MetalShaderBuildPlugin will:
- Find all
.metalfiles in the target - Compile
.ci.metalfiles in Core Image mode (-fcikernel) and other.metalfiles in standard Metal mode - Generate platform-specific Metal libraries:
AemiSDR.iOS.metallib(iOS 14.0+)AemiSDR.macOS.metallib(macOS 11.0+)
No manual compilation is required. Simply edit the .metal files and rebuild — the plugin handles the rest.
The plugin is located in Plugins/MetalShaderBuildPlugin/ and uses MetalCompilerTool (in Sources/MetalCompilerTool/) to invoke the Metal toolchain. Key features:
- Incremental builds: Shaders are only recompiled when source files change
- Xcode Cloud compatible: Uses
-fmodules=noneto avoid sandbox issues - Cross-platform: Generates libraries with correct deployment targets for each platform
This software is provided under the Mozilla Public License 2.0.