swiftui-graphics

Solid

Advanced SwiftUI visuals - Metal shaders (.colorEffect, .layerEffect, .distortionEffect), .visualEffect, Liquid Glass (iOS 26), Canvas, holographic and CRT effects.

Web & Frontend 115 stars 14 forks Updated 3 days ago MIT

Install

View on GitHub

Quality Score: 86/100

Stars 20%
69
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# SwiftUI Graphics > Advanced SwiftUI visuals: Metal shaders, visual effects, Liquid Glass, Canvas. > Loaded for advanced thesis (shaders, holographic, liquid-glass, distortion). > Foundation: `../swiftui-motion/SKILL.md` covers the basics. > Concise rules here. Deep-dives in `references/`. --- ## Decision Tree: Which API? | Need | API | |---|---| | Pixel-level color manipulation | `.colorEffect(ShaderLibrary....)` | | Pixel position / distortion | `.distortionEffect(ShaderLibrary....)` | | Full layer with overlay (mix shader + bg) | `.layerEffect(ShaderLibrary....)` | | View modifier with geometry context | `.visualEffect { content, geometry in }` | | Custom drawing (paths, gradients) | `Canvas { context, size in }` | | iOS 26+ glassmorphism | `.glassEffect()` / `GlassEffectContainer` | | Performance dump | `Canvas` with `.opaque(true)` then export | > **Default order of escalation:** built-in modifiers -> `.visualEffect` -> `Canvas` -> Metal shader. Reach for shaders only when the effect is per-pixel and animated. --- ## Metal Shaders Intro SwiftUI binds to Metal Shading Language (MSL) via three modifiers shipped in iOS 17: `.colorEffect`, `.distortionEffect`, `.layerEffect`. You author a `.metal` file in your app target, mark functions with the `[[ stitchable ]]` attribute, and SwiftUI auto-generates the Swift binding via `ShaderLibrary.<functionName>(...)`. One library per app target. Shaders run on the GPU at native resolution; arguments are passed as `.float`, `...

Details

Author
AThevon
Repository
AThevon/genjutsu
Created
4 months ago
Last Updated
3 days ago
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category