fresnel_macos

macOS implementation of fresnel.

Apps depend on fresnel, which selects this package automatically on macOS. Nothing here is meant to be imported directly.

What it does

macOS 26 (Tahoe) ships the same Liquid Glass material as iOS 26, so this package is a close mirror of fresnel_ios: an NSHostingController running SwiftUI's .glassEffect() inside an AppKitView, rendering only the material. Content stays a normal Flutter subtree composited above it, and the native view refuses the pointer outright. Text, gestures, theming and accessibility never cross the FFI boundary.

Contract member macOS
capabilities() native — ProcessInfo.isOperatingSystemAtLeast(26) plus NSWorkspace accessibility flags
buildNativeGlass() SwiftUI glassEffect(_:in:) in an AppKitView
buildNativeContainer() SwiftUI GlassEffectContainer(spacing:)
renderSymbol() NSImage(systemSymbolName:) rasterised to PNG

Below macOS 26 every one of those either reports hasNativeGlass: false or returns null, and the façade falls through to the shader path.

Why SwiftUI and not NSGlassEffectView

AppKit gained NSGlassEffectView and NSGlassEffectContainerView in macOS 26. They are real, and they merge — but they expose only cornerRadius, tintColor and a two-case style. There is no AppKit equivalent of glassEffectID (morphing between shapes and positions) or glassEffectUnion (fusing distant elements into one blob). Bridging SwiftUI is the only route to the full material, which is the same conclusion fresnel_ios reached about UIGlassEffect.

Differences from fresnel_ios

Three, all embedder-shaped rather than design decisions:

  • The Dart side builds an AppKitView instead of a UiKitView.
  • macOS has no FlutterPlatformView wrapper protocol — the factory hands the embedder a bare NSView, so GlassPlatformView is that view.
  • Refusing input means overriding hitTest(_:) to return nil. NSView has no isUserInteractionEnabled, and a hit-testable view also swallows scroll-wheel events and cursor-rect updates belonging to the Flutter content underneath.

Accessibility flags come from NSWorkspace.shared.accessibilityDisplayShould* rather than UIAccessibility.is*Enabled.

Verifying Apple's API surface

Check signatures against the SDK, not against published documentation — the shipping glassEffect has no isEnabled: parameter despite what most references claim:

SDK=$(xcrun --sdk macosx --show-sdk-path)

grep -n "func glassEffect" \
  "$SDK/System/Library/Frameworks/SwiftUICore.framework/Modules/\
SwiftUICore.swiftmodule/arm64e-apple-macos.swiftinterface"

cat "$SDK/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/\
NSGlassEffectView.h"

Layout

lib/fresnel_macos.dart                     FresnelMacos, the platform impl
macos/fresnel_macos.podspec
macos/fresnel_macos/Package.swift
macos/fresnel_macos/Sources/fresnel_macos/
  FresnelMacosPlugin.swift                 channel, capabilities, SF Symbols
  GlassPlatformView.swift                  NSView + factory, hosting, channel
  GlassSurfaceView.swift                   the SwiftUI views and their models
  GlassSpec.swift                          wire decoding for Glass/Shape/Element

License

MIT. See LICENSE.

Libraries

fresnel_macos
macOS implementation of fresnel.