claudecode-omc 5.6.7 → 5.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/.local/skills/THIRD_PARTY_LICENSES/AvdLee-SwiftUI-Agent-Skill.LICENSE +21 -0
  2. package/.local/skills/THIRD_PARTY_LICENSES/Dimillian-Skills.LICENSE +21 -0
  3. package/.local/skills/THIRD_PARTY_LICENSES/README.md +36 -0
  4. package/.local/skills/THIRD_PARTY_LICENSES/twostraws-swiftui-agent-skill.LICENSE +21 -0
  5. package/.local/skills/ios-debugger-agent/SKILL.md +51 -0
  6. package/.local/skills/ios-debugger-agent/agents/openai.yaml +4 -0
  7. package/.local/skills/swift-concurrency-expert/SKILL.md +105 -0
  8. package/.local/skills/swift-concurrency-expert/agents/openai.yaml +4 -0
  9. package/.local/skills/swift-concurrency-expert/references/approachable-concurrency.md +63 -0
  10. package/.local/skills/swift-concurrency-expert/references/swift-6-2-concurrency.md +272 -0
  11. package/.local/skills/swift-concurrency-expert/references/swiftui-concurrency-tour-wwdc.md +33 -0
  12. package/.local/skills/swiftui-expert-skill/SKILL.md +162 -0
  13. package/.local/skills/swiftui-expert-skill/references/accessibility-patterns.md +215 -0
  14. package/.local/skills/swiftui-expert-skill/references/animation-advanced.md +403 -0
  15. package/.local/skills/swiftui-expert-skill/references/animation-basics.md +284 -0
  16. package/.local/skills/swiftui-expert-skill/references/animation-transitions.md +326 -0
  17. package/.local/skills/swiftui-expert-skill/references/charts-accessibility.md +135 -0
  18. package/.local/skills/swiftui-expert-skill/references/charts.md +602 -0
  19. package/.local/skills/swiftui-expert-skill/references/focus-patterns.md +299 -0
  20. package/.local/skills/swiftui-expert-skill/references/image-optimization.md +203 -0
  21. package/.local/skills/swiftui-expert-skill/references/latest-apis.md +488 -0
  22. package/.local/skills/swiftui-expert-skill/references/layout-best-practices.md +266 -0
  23. package/.local/skills/swiftui-expert-skill/references/liquid-glass.md +423 -0
  24. package/.local/skills/swiftui-expert-skill/references/list-patterns.md +446 -0
  25. package/.local/skills/swiftui-expert-skill/references/macos-scenes.md +318 -0
  26. package/.local/skills/swiftui-expert-skill/references/macos-views.md +357 -0
  27. package/.local/skills/swiftui-expert-skill/references/macos-window-styling.md +303 -0
  28. package/.local/skills/swiftui-expert-skill/references/performance-patterns.md +403 -0
  29. package/.local/skills/swiftui-expert-skill/references/scroll-patterns.md +293 -0
  30. package/.local/skills/swiftui-expert-skill/references/sheet-navigation-patterns.md +363 -0
  31. package/.local/skills/swiftui-expert-skill/references/state-management.md +388 -0
  32. package/.local/skills/swiftui-expert-skill/references/text-patterns.md +32 -0
  33. package/.local/skills/swiftui-expert-skill/references/trace-analysis.md +295 -0
  34. package/.local/skills/swiftui-expert-skill/references/trace-recording.md +134 -0
  35. package/.local/skills/swiftui-expert-skill/references/view-structure.md +780 -0
  36. package/.local/skills/swiftui-expert-skill/scripts/__pycache__/analyze_trace.cpython-313.pyc +0 -0
  37. package/.local/skills/swiftui-expert-skill/scripts/__pycache__/record_trace.cpython-313.pyc +0 -0
  38. package/.local/skills/swiftui-expert-skill/scripts/analyze_trace.py +301 -0
  39. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__init__.py +1 -0
  40. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/__init__.cpython-313.pyc +0 -0
  41. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/causes.cpython-313.pyc +0 -0
  42. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/correlate.cpython-313.pyc +0 -0
  43. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/events.cpython-313.pyc +0 -0
  44. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/hangs.cpython-313.pyc +0 -0
  45. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/hitches.cpython-313.pyc +0 -0
  46. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/summary.cpython-313.pyc +0 -0
  47. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/swiftui.cpython-313.pyc +0 -0
  48. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/time_profiler.cpython-313.pyc +0 -0
  49. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/xctrace.cpython-313.pyc +0 -0
  50. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/__pycache__/xml_utils.cpython-313.pyc +0 -0
  51. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/causes.py +187 -0
  52. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/correlate.py +179 -0
  53. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/events.py +291 -0
  54. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/hangs.py +108 -0
  55. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/hitches.py +145 -0
  56. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/summary.py +243 -0
  57. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/swiftui.py +195 -0
  58. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/time_profiler.py +135 -0
  59. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/xctrace.py +117 -0
  60. package/.local/skills/swiftui-expert-skill/scripts/instruments_parser/xml_utils.py +224 -0
  61. package/.local/skills/swiftui-expert-skill/scripts/record_trace.py +252 -0
  62. package/.local/skills/swiftui-liquid-glass/SKILL.md +90 -0
  63. package/.local/skills/swiftui-liquid-glass/agents/openai.yaml +4 -0
  64. package/.local/skills/swiftui-liquid-glass/references/liquid-glass.md +280 -0
  65. package/.local/skills/swiftui-performance-audit/SKILL.md +106 -0
  66. package/.local/skills/swiftui-performance-audit/agents/openai.yaml +4 -0
  67. package/.local/skills/swiftui-performance-audit/references/code-smells.md +150 -0
  68. package/.local/skills/swiftui-performance-audit/references/demystify-swiftui-performance-wwdc23.md +46 -0
  69. package/.local/skills/swiftui-performance-audit/references/optimizing-swiftui-performance-instruments.md +29 -0
  70. package/.local/skills/swiftui-performance-audit/references/profiling-intake.md +44 -0
  71. package/.local/skills/swiftui-performance-audit/references/report-template.md +47 -0
  72. package/.local/skills/swiftui-performance-audit/references/understanding-hangs-in-your-app.md +33 -0
  73. package/.local/skills/swiftui-performance-audit/references/understanding-improving-swiftui-performance.md +52 -0
  74. package/.local/skills/swiftui-pro/SKILL.md +108 -0
  75. package/.local/skills/swiftui-pro/agents/openai.yaml +10 -0
  76. package/.local/skills/swiftui-pro/assets/swiftui-pro-icon.png +0 -0
  77. package/.local/skills/swiftui-pro/assets/swiftui-pro-icon.svg +29 -0
  78. package/.local/skills/swiftui-pro/references/accessibility.md +13 -0
  79. package/.local/skills/swiftui-pro/references/api.md +39 -0
  80. package/.local/skills/swiftui-pro/references/data.md +43 -0
  81. package/.local/skills/swiftui-pro/references/design.md +32 -0
  82. package/.local/skills/swiftui-pro/references/hygiene.md +9 -0
  83. package/.local/skills/swiftui-pro/references/navigation.md +14 -0
  84. package/.local/skills/swiftui-pro/references/performance.md +46 -0
  85. package/.local/skills/swiftui-pro/references/swift.md +56 -0
  86. package/.local/skills/swiftui-pro/references/views.md +36 -0
  87. package/.local/skills/swiftui-ui-patterns/SKILL.md +95 -0
  88. package/.local/skills/swiftui-ui-patterns/agents/openai.yaml +4 -0
  89. package/.local/skills/swiftui-ui-patterns/references/app-wiring.md +201 -0
  90. package/.local/skills/swiftui-ui-patterns/references/async-state.md +96 -0
  91. package/.local/skills/swiftui-ui-patterns/references/components-index.md +50 -0
  92. package/.local/skills/swiftui-ui-patterns/references/controls.md +57 -0
  93. package/.local/skills/swiftui-ui-patterns/references/deeplinks.md +66 -0
  94. package/.local/skills/swiftui-ui-patterns/references/focus.md +90 -0
  95. package/.local/skills/swiftui-ui-patterns/references/form.md +97 -0
  96. package/.local/skills/swiftui-ui-patterns/references/grids.md +71 -0
  97. package/.local/skills/swiftui-ui-patterns/references/haptics.md +71 -0
  98. package/.local/skills/swiftui-ui-patterns/references/input-toolbar.md +51 -0
  99. package/.local/skills/swiftui-ui-patterns/references/lightweight-clients.md +93 -0
  100. package/.local/skills/swiftui-ui-patterns/references/list.md +86 -0
  101. package/.local/skills/swiftui-ui-patterns/references/loading-placeholders.md +38 -0
  102. package/.local/skills/swiftui-ui-patterns/references/macos-settings.md +71 -0
  103. package/.local/skills/swiftui-ui-patterns/references/matched-transitions.md +59 -0
  104. package/.local/skills/swiftui-ui-patterns/references/media.md +73 -0
  105. package/.local/skills/swiftui-ui-patterns/references/menu-bar.md +101 -0
  106. package/.local/skills/swiftui-ui-patterns/references/navigationstack.md +159 -0
  107. package/.local/skills/swiftui-ui-patterns/references/overlay.md +45 -0
  108. package/.local/skills/swiftui-ui-patterns/references/performance.md +62 -0
  109. package/.local/skills/swiftui-ui-patterns/references/previews.md +48 -0
  110. package/.local/skills/swiftui-ui-patterns/references/scroll-reveal.md +133 -0
  111. package/.local/skills/swiftui-ui-patterns/references/scrollview.md +87 -0
  112. package/.local/skills/swiftui-ui-patterns/references/searchable.md +71 -0
  113. package/.local/skills/swiftui-ui-patterns/references/sheets.md +155 -0
  114. package/.local/skills/swiftui-ui-patterns/references/split-views.md +72 -0
  115. package/.local/skills/swiftui-ui-patterns/references/tabview.md +114 -0
  116. package/.local/skills/swiftui-ui-patterns/references/theming.md +71 -0
  117. package/.local/skills/swiftui-ui-patterns/references/title-menus.md +93 -0
  118. package/.local/skills/swiftui-ui-patterns/references/top-bar.md +49 -0
  119. package/.local/skills/swiftui-view-refactor/SKILL.md +202 -0
  120. package/.local/skills/swiftui-view-refactor/agents/openai.yaml +4 -0
  121. package/.local/skills/swiftui-view-refactor/references/mv-patterns.md +161 -0
  122. package/bundled/manifest.json +1 -1
  123. package/package.json +1 -1
@@ -0,0 +1,252 @@
1
+ #!/usr/bin/env python3
2
+ """Record an Xcode Instruments .trace file via `xctrace record`.
3
+
4
+ Three modes:
5
+ (default) Start a recording. Stops on Ctrl+C, stop-file, or time limit.
6
+ --list-devices Enumerate connected devices + simulators as JSON.
7
+ --list-templates Enumerate available Instruments templates as JSON.
8
+
9
+ Attach vs launch vs all-processes is mutually exclusive and passed straight
10
+ through to xctrace. The default template is "SwiftUI" (matches the
11
+ SwiftUI template in Xcode 26+ — change with --template).
12
+
13
+ Manual stop options, most to least automated:
14
+ * Send SIGINT (Ctrl+C) to this script — forwarded to xctrace, which
15
+ finalises the trace before exiting.
16
+ * Pass --stop-file PATH; when that file appears on disk, this script
17
+ sends SIGINT to xctrace. Useful for `Bash run_in_background`
18
+ workflows where there's no interactive terminal.
19
+ * Pass --time-limit 30s / 5m / etc. — xctrace stops itself.
20
+ """
21
+ from __future__ import annotations
22
+
23
+ import argparse
24
+ import json
25
+ import os
26
+ import re
27
+ import signal
28
+ import subprocess
29
+ import sys
30
+ import time
31
+ from datetime import datetime
32
+ from pathlib import Path
33
+
34
+
35
+ def main(argv: list[str] | None = None) -> int:
36
+ parser = argparse.ArgumentParser(description="Record an Instruments .trace file.")
37
+ list_mode = parser.add_mutually_exclusive_group()
38
+ list_mode.add_argument("--list-devices", action="store_true",
39
+ help="List devices and simulators as JSON, then exit.")
40
+ list_mode.add_argument("--list-templates", action="store_true",
41
+ help="List template names as JSON, then exit.")
42
+
43
+ parser.add_argument("--template", default="SwiftUI",
44
+ help="Template name (default: SwiftUI).")
45
+ parser.add_argument("--device", default=None,
46
+ help="Device name or UDID. Defaults to the host.")
47
+ parser.add_argument("--output", type=Path, default=None,
48
+ help="Output .trace path. Defaults to ./<template>-<timestamp>.trace.")
49
+ parser.add_argument("--time-limit", default=None,
50
+ help="Cap recording duration (e.g. 30s, 5m, 1h). Optional.")
51
+ parser.add_argument("--stop-file", type=Path, default=None,
52
+ help="When this path appears on disk, stop the recording.")
53
+ parser.add_argument("--env", action="append", default=[],
54
+ metavar="KEY=VALUE",
55
+ help="Env var for the launched process. Can repeat. Launch mode only.")
56
+ parser.add_argument("--instrument", action="append", default=[],
57
+ help="Extra --instrument flag passthrough (can repeat).")
58
+ parser.add_argument("--run-name", default=None)
59
+
60
+ target = parser.add_mutually_exclusive_group()
61
+ target.add_argument("--launch", metavar="APP",
62
+ help="Launch this .app path and record it.")
63
+ target.add_argument("--attach", metavar="PID_OR_NAME",
64
+ help="Attach to a running process by pid or name.")
65
+ target.add_argument("--all-processes", action="store_true",
66
+ help="Record every process (system-wide).")
67
+
68
+ args = parser.parse_args(argv)
69
+
70
+ if args.list_devices:
71
+ _print_devices()
72
+ return 0
73
+ if args.list_templates:
74
+ _print_templates()
75
+ return 0
76
+
77
+ if not (args.launch or args.attach or args.all_processes):
78
+ print("error: need one of --launch, --attach, or --all-processes.",
79
+ file=sys.stderr)
80
+ return 2
81
+
82
+ if args.env and not args.launch:
83
+ # xctrace silently ignores --env outside launch mode; surfacing this
84
+ # explicitly saves agents a confusing "why didn't my env var apply?".
85
+ print("error: --env only applies to --launch; remove it or switch target mode.",
86
+ file=sys.stderr)
87
+ return 2
88
+
89
+ output = args.output or Path.cwd() / _default_trace_name(args.template)
90
+ if output.exists():
91
+ print(f"error: output already exists: {output}", file=sys.stderr)
92
+ return 2
93
+
94
+ cmd = _build_xctrace_cmd(args, output)
95
+
96
+ # Tell the user (and an agent reading stdout) what's happening + how to stop.
97
+ print("[record] starting xctrace record", flush=True)
98
+ print(f"[record] template: {args.template}", flush=True)
99
+ print(f"[record] device: {args.device or '(host)'}", flush=True)
100
+ print(f"[record] target: {_describe_target(args)}", flush=True)
101
+ print(f"[record] output: {output}", flush=True)
102
+ stop_hints = ["Ctrl+C"]
103
+ if args.stop_file:
104
+ stop_hints.append(f"`touch {args.stop_file}`")
105
+ if args.time_limit:
106
+ stop_hints.append(f"after {args.time_limit}")
107
+ print(f"[record] stop via: {', '.join(stop_hints)}", flush=True)
108
+ print(f"[record] cmd: {' '.join(_shell_quote(c) for c in cmd)}", flush=True)
109
+
110
+ # Start xctrace in its own process group so we can signal cleanly.
111
+ proc = subprocess.Popen(cmd, start_new_session=True)
112
+
113
+ try:
114
+ _wait_with_stop(proc, args.stop_file)
115
+ except KeyboardInterrupt:
116
+ _forward_sigint(proc)
117
+
118
+ # Give xctrace up to 60s to finalise after SIGINT — large traces take time.
119
+ try:
120
+ rc = proc.wait(timeout=60)
121
+ except subprocess.TimeoutExpired:
122
+ print("[record] xctrace did not exit within 60s after stop; killing.",
123
+ file=sys.stderr)
124
+ proc.kill()
125
+ rc = proc.wait()
126
+
127
+ if output.exists():
128
+ print(f"[record] done. trace written: {output}", flush=True)
129
+ else:
130
+ print("[record] done but output file not found — did xctrace error?",
131
+ file=sys.stderr)
132
+ return rc or 1
133
+ return rc
134
+
135
+
136
+ def _build_xctrace_cmd(args, output: Path) -> list[str]:
137
+ cmd = ["xctrace", "record", "--template", args.template, "--output", str(output)]
138
+ if args.device:
139
+ cmd += ["--device", args.device]
140
+ if args.time_limit:
141
+ cmd += ["--time-limit", args.time_limit]
142
+ if args.run_name:
143
+ cmd += ["--run-name", args.run_name]
144
+ for inst in args.instrument:
145
+ cmd += ["--instrument", inst]
146
+ for env in args.env:
147
+ cmd += ["--env", env]
148
+ # Target must come last — --launch consumes the remainder.
149
+ if args.attach:
150
+ cmd += ["--attach", args.attach]
151
+ elif args.all_processes:
152
+ cmd += ["--all-processes"]
153
+ elif args.launch:
154
+ cmd += ["--launch", "--", args.launch]
155
+ return cmd
156
+
157
+
158
+ def _describe_target(args) -> str:
159
+ if args.launch:
160
+ return f"launch {args.launch}"
161
+ if args.attach:
162
+ return f"attach {args.attach}"
163
+ if args.all_processes:
164
+ return "all processes"
165
+ return "(none)"
166
+
167
+
168
+ def _default_trace_name(template: str) -> str:
169
+ safe = re.sub(r"[^A-Za-z0-9]+", "-", template).strip("-").lower() or "trace"
170
+ ts = datetime.now().strftime("%Y%m%d-%H%M%S")
171
+ return f"{safe}-{ts}.trace"
172
+
173
+
174
+ def _wait_with_stop(proc: subprocess.Popen, stop_file: Path | None) -> None:
175
+ """Poll until xctrace exits or stop_file appears; then send SIGINT."""
176
+ while True:
177
+ rc = proc.poll()
178
+ if rc is not None:
179
+ return
180
+ if stop_file and stop_file.exists():
181
+ print(f"[record] stop-file detected ({stop_file}); stopping xctrace.",
182
+ flush=True)
183
+ _forward_sigint(proc)
184
+ return
185
+ time.sleep(0.5)
186
+
187
+
188
+ def _forward_sigint(proc: subprocess.Popen) -> None:
189
+ try:
190
+ # Signal the whole group so child instruments tools also get SIGINT.
191
+ os.killpg(os.getpgid(proc.pid), signal.SIGINT)
192
+ except ProcessLookupError:
193
+ pass
194
+
195
+
196
+ def _print_devices() -> None:
197
+ out = subprocess.run(
198
+ ["xctrace", "list", "devices"], capture_output=True, text=True, check=True
199
+ ).stdout
200
+ devices: list[dict] = []
201
+ section = None
202
+ # Device lines end with "(UDID)"; real iOS devices also have "(OS version)"
203
+ # before the UDID. The host (macOS) line has only "(UDID)".
204
+ line_re = re.compile(r"^(.+?)(?:\s+\(([^()]+)\))?\s+\(([0-9A-Fa-f-]{20,})\)\s*$")
205
+ for line in out.splitlines():
206
+ stripped = line.strip()
207
+ if not stripped:
208
+ continue
209
+ if stripped.startswith("==") and stripped.endswith("=="):
210
+ section = stripped.strip("= ").strip().lower()
211
+ continue
212
+ m = line_re.match(stripped)
213
+ if not m:
214
+ continue
215
+ name, os_ver, udid = m.group(1).strip(), m.group(2), m.group(3)
216
+ devices.append({
217
+ "kind": section or "unknown",
218
+ "name": name,
219
+ "os": os_ver,
220
+ "udid": udid,
221
+ })
222
+ print(json.dumps({"devices": devices}, indent=2))
223
+
224
+
225
+ def _print_templates() -> None:
226
+ out = subprocess.run(
227
+ ["xctrace", "list", "templates"], capture_output=True, text=True, check=True
228
+ ).stdout
229
+ groups: dict[str, list[str]] = {}
230
+ section = "unknown"
231
+ for line in out.splitlines():
232
+ stripped = line.strip()
233
+ if not stripped:
234
+ continue
235
+ if stripped.startswith("==") and stripped.endswith("=="):
236
+ section = stripped.strip("= ").strip().lower()
237
+ groups.setdefault(section, [])
238
+ continue
239
+ groups.setdefault(section, []).append(stripped)
240
+ # Flat convenience list + structured by section.
241
+ flat = [name for items in groups.values() for name in items]
242
+ print(json.dumps({"templates": flat, "by_section": groups}, indent=2))
243
+
244
+
245
+ def _shell_quote(s: str) -> str:
246
+ if re.match(r"^[A-Za-z0-9_./:=@-]+$", s):
247
+ return s
248
+ return "'" + s.replace("'", "'\\''") + "'"
249
+
250
+
251
+ if __name__ == "__main__":
252
+ sys.exit(main())
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: swiftui-liquid-glass
3
+ description: Implement, review, or improve SwiftUI features using the iOS 26+ Liquid Glass API. Use when asked to adopt Liquid Glass in new SwiftUI UI, refactor an existing feature to Liquid Glass, or review Liquid Glass usage for correctness, performance, and design alignment.
4
+ ---
5
+
6
+ # SwiftUI Liquid Glass
7
+
8
+ ## Overview
9
+ Use this skill to build or review SwiftUI features that fully align with the iOS 26+ Liquid Glass API. Prioritize native APIs (`glassEffect`, `GlassEffectContainer`, glass button styles) and Apple design guidance. Keep usage consistent, interactive where needed, and performance aware.
10
+
11
+ ## Workflow Decision Tree
12
+ Choose the path that matches the request:
13
+
14
+ ### 1) Review an existing feature
15
+ - Inspect where Liquid Glass should be used and where it should not.
16
+ - Verify correct modifier order, shape usage, and container placement.
17
+ - Check for iOS 26+ availability handling and sensible fallbacks.
18
+
19
+ ### 2) Improve a feature using Liquid Glass
20
+ - Identify target components for glass treatment (surfaces, chips, buttons, cards).
21
+ - Refactor to use `GlassEffectContainer` where multiple glass elements appear.
22
+ - Introduce interactive glass only for tappable or focusable elements.
23
+
24
+ ### 3) Implement a new feature using Liquid Glass
25
+ - Design the glass surfaces and interactions first (shape, prominence, grouping).
26
+ - Add glass modifiers after layout/appearance modifiers.
27
+ - Add morphing transitions only when the view hierarchy changes with animation.
28
+
29
+ ## Core Guidelines
30
+ - Prefer native Liquid Glass APIs over custom blurs.
31
+ - Use `GlassEffectContainer` when multiple glass elements coexist.
32
+ - Apply `.glassEffect(...)` after layout and visual modifiers.
33
+ - Use `.interactive()` for elements that respond to touch/pointer.
34
+ - Keep shapes consistent across related elements for a cohesive look.
35
+ - Gate with `#available(iOS 26, *)` and provide a non-glass fallback.
36
+
37
+ ## Review Checklist
38
+ - **Availability**: `#available(iOS 26, *)` present with fallback UI.
39
+ - **Composition**: Multiple glass views wrapped in `GlassEffectContainer`.
40
+ - **Modifier order**: `glassEffect` applied after layout/appearance modifiers.
41
+ - **Interactivity**: `interactive()` only where user interaction exists.
42
+ - **Transitions**: `glassEffectID` used with `@Namespace` for morphing.
43
+ - **Consistency**: Shapes, tinting, and spacing align across the feature.
44
+
45
+ ## Implementation Checklist
46
+ - Define target elements and desired glass prominence.
47
+ - Wrap grouped glass elements in `GlassEffectContainer` and tune spacing.
48
+ - Use `.glassEffect(.regular.tint(...).interactive(), in: .rect(cornerRadius: ...))` as needed.
49
+ - Use `.buttonStyle(.glass)` / `.buttonStyle(.glassProminent)` for actions.
50
+ - Add morphing transitions with `glassEffectID` when hierarchy changes.
51
+ - Provide fallback materials and visuals for earlier iOS versions.
52
+
53
+ ## Quick Snippets
54
+ Use these patterns directly and tailor shapes/tints/spacing.
55
+
56
+ ```swift
57
+ if #available(iOS 26, *) {
58
+ Text("Hello")
59
+ .padding()
60
+ .glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
61
+ } else {
62
+ Text("Hello")
63
+ .padding()
64
+ .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))
65
+ }
66
+ ```
67
+
68
+ ```swift
69
+ GlassEffectContainer(spacing: 24) {
70
+ HStack(spacing: 24) {
71
+ Image(systemName: "scribble.variable")
72
+ .frame(width: 72, height: 72)
73
+ .font(.system(size: 32))
74
+ .glassEffect()
75
+ Image(systemName: "eraser.fill")
76
+ .frame(width: 72, height: 72)
77
+ .font(.system(size: 32))
78
+ .glassEffect()
79
+ }
80
+ }
81
+ ```
82
+
83
+ ```swift
84
+ Button("Confirm") { }
85
+ .buttonStyle(.glassProminent)
86
+ ```
87
+
88
+ ## Resources
89
+ - Reference guide: `references/liquid-glass.md`
90
+ - Prefer Apple docs for up-to-date API details.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "SwiftUI Liquid Glass"
3
+ short_description: "Build SwiftUI Liquid Glass features"
4
+ default_prompt: "Use $swiftui-liquid-glass to implement or review a SwiftUI feature using Liquid Glass APIs."
@@ -0,0 +1,280 @@
1
+ # Implementing Liquid Glass Design in SwiftUI
2
+
3
+ ## Overview
4
+
5
+ Liquid Glass is a dynamic material introduced in iOS that combines the optical properties of glass with a sense of fluidity. It blurs content behind it, reflects color and light from surrounding content, and reacts to touch and pointer interactions in real time. This guide covers how to implement and customize Liquid Glass effects in SwiftUI applications. You should always seek guides on Liquid Glass when asked for help adopting new Apple design.
6
+
7
+ Key features of Liquid Glass:
8
+ - Blurs content behind the material
9
+ - Reflects color and light from surrounding content
10
+ - Reacts to touch and pointer interactions
11
+ - Can morph between shapes during transitions
12
+ - Available for standard and custom components
13
+
14
+ ## Basic Implementation
15
+
16
+ ### Adding Liquid Glass to a View
17
+
18
+ The simplest way to add Liquid Glass to a view is using the `glassEffect()` modifier:
19
+
20
+ ```swift
21
+ Text("Hello, World!")
22
+ .font(.title)
23
+ .padding()
24
+ .glassEffect()
25
+ ```
26
+
27
+ By default, this applies the regular variant of Glass within a Capsule shape behind the view's content.
28
+
29
+ ### Customizing the Shape
30
+
31
+ You can specify a different shape for the Liquid Glass effect:
32
+
33
+ ```swift
34
+ Text("Hello, World!")
35
+ .font(.title)
36
+ .padding()
37
+ .glassEffect(in: .rect(cornerRadius: 16.0))
38
+ ```
39
+
40
+ Common shape options:
41
+ - `.capsule` (default)
42
+ - `.rect(cornerRadius: CGFloat)`
43
+ - `.circle`
44
+
45
+ ## Customizing Liquid Glass Effects
46
+
47
+ ### Glass Variants and Properties
48
+
49
+ You can customize the Liquid Glass effect by configuring the `Glass` structure:
50
+
51
+ ```swift
52
+ Text("Hello, World!")
53
+ .font(.title)
54
+ .padding()
55
+ .glassEffect(.regular.tint(.orange).interactive())
56
+ ```
57
+
58
+ Key customization options:
59
+ - `.regular` - Standard glass effect
60
+ - `.tint(Color)` - Add a color tint to suggest prominence
61
+ - `.interactive(Bool)` - Make the glass react to touch and pointer interactions
62
+
63
+ ### Making Interactive Glass
64
+
65
+ To make Liquid Glass react to touch and pointer interactions:
66
+
67
+ ```swift
68
+ Text("Hello, World!")
69
+ .font(.title)
70
+ .padding()
71
+ .glassEffect(.regular.interactive(true))
72
+ ```
73
+
74
+ Or more concisely:
75
+
76
+ ```swift
77
+ Text("Hello, World!")
78
+ .font(.title)
79
+ .padding()
80
+ .glassEffect(.regular.interactive())
81
+ ```
82
+
83
+ ## Working with Multiple Glass Effects
84
+
85
+ ### Using GlassEffectContainer
86
+
87
+ When applying Liquid Glass effects to multiple views, use `GlassEffectContainer` for better rendering performance and to enable blending and morphing effects:
88
+
89
+ ```swift
90
+ GlassEffectContainer(spacing: 40.0) {
91
+ HStack(spacing: 40.0) {
92
+ Image(systemName: "scribble.variable")
93
+ .frame(width: 80.0, height: 80.0)
94
+ .font(.system(size: 36))
95
+ .glassEffect()
96
+
97
+ Image(systemName: "eraser.fill")
98
+ .frame(width: 80.0, height: 80.0)
99
+ .font(.system(size: 36))
100
+ .glassEffect()
101
+ }
102
+ }
103
+ ```
104
+
105
+ The `spacing` parameter controls how the Liquid Glass effects interact with each other:
106
+ - Smaller spacing: Views need to be closer to merge effects
107
+ - Larger spacing: Effects merge at greater distances
108
+
109
+ ### Uniting Multiple Glass Effects
110
+
111
+ To combine multiple views into a single Liquid Glass effect, use the `glassEffectUnion` modifier:
112
+
113
+ ```swift
114
+ @Namespace private var namespace
115
+
116
+ // Later in your view:
117
+ GlassEffectContainer(spacing: 20.0) {
118
+ HStack(spacing: 20.0) {
119
+ ForEach(symbolSet.indices, id: \.self) { item in
120
+ Image(systemName: symbolSet[item])
121
+ .frame(width: 80.0, height: 80.0)
122
+ .font(.system(size: 36))
123
+ .glassEffect()
124
+ .glassEffectUnion(id: item < 2 ? "1" : "2", namespace: namespace)
125
+ }
126
+ }
127
+ }
128
+ ```
129
+
130
+ This is useful when creating views dynamically or with views that live outside of an HStack or VStack.
131
+
132
+ ## Morphing Effects and Transitions
133
+
134
+ ### Creating Morphing Transitions
135
+
136
+ To create morphing effects during transitions between views with Liquid Glass:
137
+
138
+ 1. Create a namespace using the `@Namespace` property wrapper
139
+ 2. Associate each Liquid Glass effect with a unique identifier using `glassEffectID`
140
+ 3. Use animations when changing the view hierarchy
141
+
142
+ ```swift
143
+ @State private var isExpanded: Bool = false
144
+ @Namespace private var namespace
145
+
146
+ var body: some View {
147
+ GlassEffectContainer(spacing: 40.0) {
148
+ HStack(spacing: 40.0) {
149
+ Image(systemName: "scribble.variable")
150
+ .frame(width: 80.0, height: 80.0)
151
+ .font(.system(size: 36))
152
+ .glassEffect()
153
+ .glassEffectID("pencil", in: namespace)
154
+
155
+ if isExpanded {
156
+ Image(systemName: "eraser.fill")
157
+ .frame(width: 80.0, height: 80.0)
158
+ .font(.system(size: 36))
159
+ .glassEffect()
160
+ .glassEffectID("eraser", in: namespace)
161
+ }
162
+ }
163
+ }
164
+
165
+ Button("Toggle") {
166
+ withAnimation {
167
+ isExpanded.toggle()
168
+ }
169
+ }
170
+ .buttonStyle(.glass)
171
+ }
172
+ ```
173
+
174
+ The morphing effect occurs when views with Liquid Glass appear or disappear due to view hierarchy changes.
175
+
176
+ ## Button Styling with Liquid Glass
177
+
178
+ ### Glass Button Style
179
+
180
+ SwiftUI provides built-in button styles for Liquid Glass:
181
+
182
+ ```swift
183
+ Button("Click Me") {
184
+ // Action
185
+ }
186
+ .buttonStyle(.glass)
187
+ ```
188
+
189
+ ### Glass Prominent Button Style
190
+
191
+ For a more prominent glass button:
192
+
193
+ ```swift
194
+ Button("Important Action") {
195
+ // Action
196
+ }
197
+ .buttonStyle(.glassProminent)
198
+ ```
199
+
200
+ ## Advanced Techniques
201
+
202
+ ### Background Extension Effect
203
+
204
+ To stretch content behind a sidebar or inspector with the background extension effect:
205
+
206
+ ```swift
207
+ NavigationSplitView {
208
+ // Sidebar content
209
+ } detail: {
210
+ // Detail content
211
+ .background {
212
+ // Background content that extends under the sidebar
213
+ }
214
+ }
215
+ ```
216
+
217
+ ### Extending Horizontal Scrolling Under Sidebar
218
+
219
+ To extend horizontal scroll views under a sidebar or inspector:
220
+
221
+ ```swift
222
+ ScrollView(.horizontal) {
223
+ // Scrollable content
224
+ }
225
+ .scrollExtensionMode(.underSidebar)
226
+ ```
227
+
228
+ ## Best Practices
229
+
230
+ 1. **Container Usage**: Always use `GlassEffectContainer` when applying Liquid Glass to multiple views for better performance and morphing effects.
231
+
232
+ 2. **Effect Order**: Apply the `.glassEffect()` modifier after other modifiers that affect the appearance of the view.
233
+
234
+ 3. **Spacing Consideration**: Carefully choose spacing values in containers to control how and when glass effects merge.
235
+
236
+ 4. **Animation**: Use animations when changing view hierarchies to enable smooth morphing transitions.
237
+
238
+ 5. **Interactivity**: Add `.interactive()` to glass effects that should respond to user interaction.
239
+
240
+ 6. **Consistent Design**: Maintain consistent shapes and styles across your app for a cohesive look and feel.
241
+
242
+ ## Example: Custom Badge with Liquid Glass
243
+
244
+ ```swift
245
+ struct BadgeView: View {
246
+ let symbol: String
247
+ let color: Color
248
+
249
+ var body: some View {
250
+ ZStack {
251
+ Image(systemName: "hexagon.fill")
252
+ .foregroundColor(color)
253
+ .font(.system(size: 50))
254
+
255
+ Image(systemName: symbol)
256
+ .foregroundColor(.white)
257
+ .font(.system(size: 30))
258
+ }
259
+ .glassEffect(.regular, in: .rect(cornerRadius: 16))
260
+ }
261
+ }
262
+
263
+ // Usage:
264
+ GlassEffectContainer(spacing: 20) {
265
+ HStack(spacing: 20) {
266
+ BadgeView(symbol: "star.fill", color: .blue)
267
+ BadgeView(symbol: "heart.fill", color: .red)
268
+ BadgeView(symbol: "leaf.fill", color: .green)
269
+ }
270
+ }
271
+ ```
272
+
273
+ ## References
274
+
275
+ - [Applying Liquid Glass to custom views](https://developer.apple.com/documentation/SwiftUI/Applying-Liquid-Glass-to-custom-views)
276
+ - [Landmarks: Building an app with Liquid Glass](https://developer.apple.com/documentation/SwiftUI/Landmarks-Building-an-app-with-Liquid-Glass)
277
+ - [SwiftUI View.glassEffect(_:in:isEnabled:)](https://developer.apple.com/documentation/SwiftUI/View/glassEffect(_:in:isEnabled:))
278
+ - [SwiftUI GlassEffectContainer](https://developer.apple.com/documentation/SwiftUI/GlassEffectContainer)
279
+ - [SwiftUI GlassEffectTransition](https://developer.apple.com/documentation/SwiftUI/GlassEffectTransition)
280
+ - [SwiftUI GlassButtonStyle](https://developer.apple.com/documentation/SwiftUI/GlassButtonStyle)