A SwiftUI modifier that brings Apple's iOS 26 Liquid Glass material to any view, with a high-fidelity fallback for iOS 17 and 18.
| Styles | Components |
|---|---|
![]() |
![]() |
dependencies: [
.package(url: "https://github.com/rguillen-dev/LiquidGlass.git", from: "0.1.0")
],
targets: [
.target(
name: "YourTarget",
dependencies: ["LiquidGlass"]
)
]File ▸ Add Package Dependencies… and paste:
https://github.com/rguillen-dev/LiquidGlass.git
A runnable iOS demo lives at DemoApp/. Open
DemoApp/LiquidGlassDemo.xcodeproj in Xcode and hit ⌘R — the project pulls in
the local LiquidGlass package from this repo via a relative path, so no
remote checkout is needed. Bundle ID dev.ricardoguillen.LiquidGlassDemo,
minimum deployment iOS 17.0.
import SwiftUI
import LiquidGlass
struct NowPlayingCard: View {
var body: some View {
VStack(alignment: .leading) {
Text("Now Playing").font(.headline)
Text("Synthwave Drive").font(.subheadline)
}
.padding()
.glass(style: .card, tint: .indigo)
}
}Use the prebuilt components when you want a complete surface:
GlassCard(tint: .blue) {
Text("Hello, glass.")
}
GlassButton(tint: .pink) {
// action
} label: {
Label("Continue", systemImage: "arrow.right")
}| Parameter | Type | Default | Description |
|---|---|---|---|
style |
GlassStyle |
.sheet |
Visual variant. Controls thickness, depth, and default corner radius. |
tint |
Color? |
nil |
Low-opacity color overlay applied on top of the material. |
cornerRadius |
CGFloat? |
nil |
Overrides the style's default corner radius when provided. |
| Case | Role | Default corner radius |
|---|---|---|
.sheet |
Floating panel, prominent depth | 24 |
.card |
Contained surface, medium depth | 16 |
.button |
Compact, interactive feel | 12 |
.toolbar |
Inline bar element | 10 |
.sidebar |
Full-height navigation surface | 20 |
.overlay |
Full coverage, max blur | 0 |
| Type | Description |
|---|---|
GlassCard |
Container that wraps content with padding and the glass material. |
GlassButton |
Button styled with the glass material and a press-state animation. |
On iOS 26 and later, LiquidGlass uses Apple's native glassEffect(_:in:)
API directly.
On iOS 17 and 18, the package renders a hand-tuned approximation:
- A
Materialbase layer chosen per style (.ultraThinMaterialfor.sheet,.thickMaterialfor.sidebar, and so on) - A 0.5 pt inner stroke at 10–20% white opacity to simulate refracting glass
- A per-style depth shadow that scales with the role of the surface
- Optional tint, layered as a low-opacity fill above the material
The result reads as glass on every supported OS — your UI keeps the same intent whether it ships on iOS 17 or iOS 26.
The native iOS 26 path inherits Reduce Transparency and Reduce Motion from the system automatically. The iOS 17–18 fallback reads these settings itself:
- Reduce Transparency — the surface drops its translucent material for an opaque fill and raises the inner-stroke contrast.
- Reduce Motion —
GlassButtondisables its press scale/bounce animation, keeping only an instantaneous opacity dim as press feedback.
- Swift 6.0+
- iOS 17.0+
- Xcode 16.0+ (Xcode 26+ recommended for native Liquid Glass rendering)
MIT — see LICENSE.
Built by Ricardo Guillen · ricardoguillen.dev


