Download this file
| 1 | import SwiftUI |
| 2 | |
| 3 | // Liquid Glass on iOS 26, thin material below — one modifier so every floating |
| 4 | // element falls back the same way. (Split out of the retired ChatView.swift; |
| 5 | // used by composers, headers, and chips across the app.) |
| 6 | extension View { |
| 7 | @ViewBuilder func floatingGlass<S: InsettableShape>(in shape: S) -> some View { |
| 8 | #if os(iOS) |
| 9 | if #available(iOS 26.0, *) { |
| 10 | self.glassEffect(.regular, in: shape) |
| 11 | } else { |
| 12 | scrollSafeGlass(in: shape) |
| 13 | } |
| 14 | #else |
| 15 | scrollSafeGlass(in: shape) |
| 16 | #endif |
| 17 | } |
| 18 | |
| 19 | // For glass that floats OVER SCROLLING CONTENT: the liquid-glass lens |
| 20 | // refracts and duplicates whatever passes beneath it — over the chat |
| 21 | // feed that rendered as ghosted, stacked, compressed bubbles sliding |
| 22 | // under the header (the 2026-07-20 hunt; the /bareedges bisect convicted |
| 23 | // the glass, not the list). A material blurs its backdrop without |
| 24 | // lensing, so surfaces on the scroll path use this on every OS. |
| 25 | func scrollSafeGlass<S: InsettableShape>(in shape: S) -> some View { |
| 26 | self.background(.ultraThinMaterial, in: shape) |
| 27 | .overlay(shape.strokeBorder(Color(.separator).opacity(0.4), lineWidth: 0.5)) |
| 28 | } |
| 29 | } |
| 30 | |