Skip to content

Glassifying Custom Views (SwiftUI)

A SwiftUI guide for coding agents. Also covers glasseffect modifier, liquid glass custom view, glass tint interactive, glass regular clear identity, glass shape circle, conditional glass effect.

The glassEffect view modifier puts Liquid Glass on any view. Glass is not a static background: it reacts to the content behind it, and can even flip the view's color scheme between light and dark as different content scrolls past.

One modifier

ScrollView { /* content */ }
  .safeAreaInset(edge: .bottom) {
    Text("Hello, World!")
      .padding()
      .glassEffect()
  }
}

Three Glass variants

The Glass type ships regular, clear, and identity. regular is the system default, clear is more transparent, and identity renders no glass, which makes conditional toggling clean.

.glassEffect(isEnabled ? .regular : .identity)

Tint and interactivity

tint blends a color into the glass. interactive() makes the glass respond more strongly to the content behind it and handle gestures such as tap and drag; use it on glass that acts as a control.

.glassEffect(.clear.tint(.red))
.glassEffect(.clear.interactive())

Shape

The second parameter sets the glass shape, DefaultGlassEffectShape unless you pass one.

.glassEffect(.clear, in: .circle)

Use this guidance in your coding agent

Install the Better Design MCP once. Your agent then loads this page with one call.

get-swiftui-guide({ topic: "swiftui-glassifying-custom-swiftui-views" })
claude mcp add --scope user better-design --transport http https://better-design.com/api/mcp --header "Authorization: Bearer <YOUR_API_KEY>"
Browse related design systems