Liquid Glass in AppKit
Quick Reference
Class | Purpose | Key Properties |
---|---|---|
NSGlassEffectView | Single glass effect | contentView , cornerRadius , tintColor |
NSGlassEffectContainerView | Multiple glass effects | contentView , spacing |
NSGlassEffectView
Basic Usage
Interactive Glass
NSGlassEffectContainerView
Container Setup
Animated Merging
Custom Components
Glass Button
Glass Toolbar
Best Practices
Z-Order
- Only
contentView
guaranteed inside effect - Arbitrary subviews may render incorrectly
Performance
- Batch in containers when possible
- Limit total glass views (5-10 max)
- Disable when scrolling for performance
Animation
- Use
NSAnimationContext
for smooth transitions - Standard duration: 0.2-0.5 seconds
- Animate
tintColor
for state changes
Common Issues
Issue | Solution |
---|---|
Glass not visible | Check view hierarchy, ensure added to window |
Performance lag | Use containers, reduce glass count |
Merge not working | Check container spacing value |
Content outside glass | Use contentView property exclusively |