buildanything 1.7.1 → 1.8.0

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 (221) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +55 -0
  4. package/agents/ios-app-review-guardian.md +49 -0
  5. package/agents/ios-foundation-models-specialist.md +46 -0
  6. package/agents/ios-storekit-specialist.md +52 -0
  7. package/agents/ios-swift-architect.md +102 -0
  8. package/agents/ios-swift-search.md +130 -0
  9. package/agents/ios-swift-ui-design.md +104 -0
  10. package/commands/build.md +80 -176
  11. package/commands/fix.md +65 -0
  12. package/commands/setup.md +73 -0
  13. package/commands/ux-review.md +63 -0
  14. package/commands/verify.md +72 -0
  15. package/hooks/session-start +18 -1
  16. package/package.json +5 -2
  17. package/protocols/brainstorm.md +99 -0
  18. package/protocols/build-fix.md +52 -0
  19. package/protocols/cleanup.md +54 -0
  20. package/protocols/design.md +269 -0
  21. package/protocols/eval-harness.md +61 -0
  22. package/protocols/fake-data-detector.md +64 -0
  23. package/protocols/ios-context.md +235 -0
  24. package/protocols/ios-frameworks-map.md +323 -0
  25. package/protocols/ios-phase-branches.md +162 -0
  26. package/protocols/ios-preflight.md +27 -0
  27. package/protocols/metric-loop.md +93 -0
  28. package/protocols/planning.md +87 -0
  29. package/protocols/smoke-test.md +110 -0
  30. package/protocols/verify.md +67 -0
  31. package/protocols/web-phase-branches.md +201 -0
  32. package/skills/ios/_VENDORED.md +60 -0
  33. package/skills/ios/activitykit/LICENSE +131 -0
  34. package/skills/ios/activitykit/SKILL.md +505 -0
  35. package/skills/ios/activitykit/references/activitykit-patterns.md +868 -0
  36. package/skills/ios/app-intents/LICENSE +131 -0
  37. package/skills/ios/app-intents/SKILL.md +494 -0
  38. package/skills/ios/app-intents/references/appintents-advanced.md +1076 -0
  39. package/skills/ios/apple-on-device-ai/LICENSE +131 -0
  40. package/skills/ios/apple-on-device-ai/SKILL.md +505 -0
  41. package/skills/ios/apple-on-device-ai/references/coreml-conversion.md +425 -0
  42. package/skills/ios/apple-on-device-ai/references/coreml-optimization.md +344 -0
  43. package/skills/ios/apple-on-device-ai/references/foundation-models.md +508 -0
  44. package/skills/ios/apple-on-device-ai/references/mlx-swift.md +285 -0
  45. package/skills/ios/ios-26-platform/SKILL.md +53 -0
  46. package/skills/ios/ios-26-platform/references/automatic-adoption.md +161 -0
  47. package/skills/ios/ios-26-platform/references/backward-compat.md +238 -0
  48. package/skills/ios/ios-26-platform/references/liquid-glass.md +255 -0
  49. package/skills/ios/ios-26-platform/references/swiftui-apis.md +277 -0
  50. package/skills/ios/ios-26-platform/references/toolbar-navigation.md +250 -0
  51. package/skills/ios/ios-bootstrap/SKILL.md +98 -0
  52. package/skills/ios/ios-bootstrap/references/apple-docs-mcp-config.md +28 -0
  53. package/skills/ios/ios-bootstrap/references/new-project-dialog.md +41 -0
  54. package/skills/ios/ios-bootstrap/references/xcode-mcp-config.md +29 -0
  55. package/skills/ios/ios-debugger-agent/LICENSE +21 -0
  56. package/skills/ios/ios-debugger-agent/SKILL.md +58 -0
  57. package/skills/ios/ios-debugger-agent/agents/openai.yaml +4 -0
  58. package/skills/ios/ios-entitlements-generator/SKILL.md +47 -0
  59. package/skills/ios/ios-hig/SKILL.md +41 -0
  60. package/skills/ios/ios-hig/references/accessibility.md +81 -0
  61. package/skills/ios/ios-hig/references/content.md +142 -0
  62. package/skills/ios/ios-hig/references/feedback.md +123 -0
  63. package/skills/ios/ios-hig/references/interaction.md +199 -0
  64. package/skills/ios/ios-hig/references/performance-platform.md +129 -0
  65. package/skills/ios/ios-hig/references/privacy-permissions.md +181 -0
  66. package/skills/ios/ios-hig/references/visual-design.md +84 -0
  67. package/skills/ios/ios-info-plist-hardening/SKILL.md +130 -0
  68. package/skills/ios/ios-maestro-flow-author/SKILL.md +68 -0
  69. package/skills/ios/ios-maestro-flow-author/references/input-and-scroll.yaml +17 -0
  70. package/skills/ios/ios-maestro-flow-author/references/modal-and-dismiss.yaml +14 -0
  71. package/skills/ios/ios-maestro-flow-author/references/onboarding-flow.yaml +16 -0
  72. package/skills/ios/ios-maestro-flow-author/references/tab-navigation.yaml +13 -0
  73. package/skills/ios/ios-maestro-flow-author/references/tap-and-assert.yaml +9 -0
  74. package/skills/ios/swift-accessibility/LICENSE +21 -0
  75. package/skills/ios/swift-accessibility/SKILL.md +371 -0
  76. package/skills/ios/swift-accessibility/examples/before-after-appkit.md +446 -0
  77. package/skills/ios/swift-accessibility/examples/before-after-swiftui.md +441 -0
  78. package/skills/ios/swift-accessibility/examples/before-after-uikit.md +464 -0
  79. package/skills/ios/swift-accessibility/references/assistive-access.md +441 -0
  80. package/skills/ios/swift-accessibility/references/display-settings.md +491 -0
  81. package/skills/ios/swift-accessibility/references/dynamic-type.md +420 -0
  82. package/skills/ios/swift-accessibility/references/media-accessibility.md +421 -0
  83. package/skills/ios/swift-accessibility/references/motor-input.md +393 -0
  84. package/skills/ios/swift-accessibility/references/nutrition-labels.md +362 -0
  85. package/skills/ios/swift-accessibility/references/platform-specifics.md +515 -0
  86. package/skills/ios/swift-accessibility/references/semantic-structure.md +585 -0
  87. package/skills/ios/swift-accessibility/references/testing-auditing.md +507 -0
  88. package/skills/ios/swift-accessibility/references/voice-control.md +317 -0
  89. package/skills/ios/swift-accessibility/references/voiceover-swiftui.md +584 -0
  90. package/skills/ios/swift-accessibility/references/voiceover-uikit.md +519 -0
  91. package/skills/ios/swift-accessibility/references/wcag-mapping.md +167 -0
  92. package/skills/ios/swift-accessibility/resources/audit-template.swift +128 -0
  93. package/skills/ios/swift-accessibility/resources/qa-checklist.md +258 -0
  94. package/skills/ios/swift-concurrency/LICENSE +21 -0
  95. package/skills/ios/swift-concurrency/SKILL.md +171 -0
  96. package/skills/ios/swift-concurrency/references/_index.md +50 -0
  97. package/skills/ios/swift-concurrency/references/actors.md +660 -0
  98. package/skills/ios/swift-concurrency/references/async-algorithms.md +847 -0
  99. package/skills/ios/swift-concurrency/references/async-await-basics.md +266 -0
  100. package/skills/ios/swift-concurrency/references/async-sequences.md +710 -0
  101. package/skills/ios/swift-concurrency/references/core-data.md +560 -0
  102. package/skills/ios/swift-concurrency/references/glossary.md +135 -0
  103. package/skills/ios/swift-concurrency/references/linting.md +155 -0
  104. package/skills/ios/swift-concurrency/references/memory-management.md +569 -0
  105. package/skills/ios/swift-concurrency/references/migration.md +1104 -0
  106. package/skills/ios/swift-concurrency/references/performance.md +593 -0
  107. package/skills/ios/swift-concurrency/references/sendable.md +598 -0
  108. package/skills/ios/swift-concurrency/references/tasks.md +636 -0
  109. package/skills/ios/swift-concurrency/references/testing.md +592 -0
  110. package/skills/ios/swift-concurrency/references/threading.md +495 -0
  111. package/skills/ios/swift-security-expert/LICENSE +21 -0
  112. package/skills/ios/swift-security-expert/SKILL.md +470 -0
  113. package/skills/ios/swift-security-expert/references/biometric-authentication.md +565 -0
  114. package/skills/ios/swift-security-expert/references/certificate-trust.md +592 -0
  115. package/skills/ios/swift-security-expert/references/common-anti-patterns.md +690 -0
  116. package/skills/ios/swift-security-expert/references/compliance-owasp-mapping.md +537 -0
  117. package/skills/ios/swift-security-expert/references/credential-storage-patterns.md +721 -0
  118. package/skills/ios/swift-security-expert/references/cryptokit-public-key.md +505 -0
  119. package/skills/ios/swift-security-expert/references/cryptokit-symmetric.md +497 -0
  120. package/skills/ios/swift-security-expert/references/keychain-access-control.md +508 -0
  121. package/skills/ios/swift-security-expert/references/keychain-fundamentals.md +596 -0
  122. package/skills/ios/swift-security-expert/references/keychain-item-classes.md +476 -0
  123. package/skills/ios/swift-security-expert/references/keychain-sharing.md +458 -0
  124. package/skills/ios/swift-security-expert/references/migration-legacy-stores.md +727 -0
  125. package/skills/ios/swift-security-expert/references/secure-enclave.md +539 -0
  126. package/skills/ios/swift-security-expert/references/testing-security-code.md +781 -0
  127. package/skills/ios/swift-testing-expert/LICENSE +21 -0
  128. package/skills/ios/swift-testing-expert/SKILL.md +79 -0
  129. package/skills/ios/swift-testing-expert/references/_index.md +12 -0
  130. package/skills/ios/swift-testing-expert/references/async-testing-and-waiting.md +127 -0
  131. package/skills/ios/swift-testing-expert/references/expectations.md +145 -0
  132. package/skills/ios/swift-testing-expert/references/fundamentals.md +141 -0
  133. package/skills/ios/swift-testing-expert/references/migration-from-xctest.md +127 -0
  134. package/skills/ios/swift-testing-expert/references/parallelization-and-isolation.md +95 -0
  135. package/skills/ios/swift-testing-expert/references/parameterized-testing.md +284 -0
  136. package/skills/ios/swift-testing-expert/references/performance-and-best-practices.md +187 -0
  137. package/skills/ios/swift-testing-expert/references/traits-and-tags.md +114 -0
  138. package/skills/ios/swift-testing-expert/references/xcode-workflows.md +70 -0
  139. package/skills/ios/swiftdata-pro/LICENSE +21 -0
  140. package/skills/ios/swiftdata-pro/SKILL.md +102 -0
  141. package/skills/ios/swiftdata-pro/agents/openai.yaml +10 -0
  142. package/skills/ios/swiftdata-pro/assets/swiftdata-pro-icon.png +0 -0
  143. package/skills/ios/swiftdata-pro/assets/swiftdata-pro-icon.svg +29 -0
  144. package/skills/ios/swiftdata-pro/references/class-inheritance.md +104 -0
  145. package/skills/ios/swiftdata-pro/references/cloudkit.md +10 -0
  146. package/skills/ios/swiftdata-pro/references/core-rules.md +20 -0
  147. package/skills/ios/swiftdata-pro/references/indexing.md +27 -0
  148. package/skills/ios/swiftdata-pro/references/predicates.md +73 -0
  149. package/skills/ios/swiftui-design-principles/AGENTS.md +21 -0
  150. package/skills/ios/swiftui-design-principles/LICENSE +21 -0
  151. package/skills/ios/swiftui-design-principles/README.md +41 -0
  152. package/skills/ios/swiftui-design-principles/SKILL.md +605 -0
  153. package/skills/ios/swiftui-design-principles/metadata.json +10 -0
  154. package/skills/ios/swiftui-liquid-glass/LICENSE +21 -0
  155. package/skills/ios/swiftui-liquid-glass/SKILL.md +95 -0
  156. package/skills/ios/swiftui-liquid-glass/agents/openai.yaml +4 -0
  157. package/skills/ios/swiftui-liquid-glass/references/liquid-glass.md +280 -0
  158. package/skills/ios/swiftui-performance-audit/LICENSE +21 -0
  159. package/skills/ios/swiftui-performance-audit/SKILL.md +111 -0
  160. package/skills/ios/swiftui-performance-audit/agents/openai.yaml +4 -0
  161. package/skills/ios/swiftui-performance-audit/references/code-smells.md +150 -0
  162. package/skills/ios/swiftui-performance-audit/references/demystify-swiftui-performance-wwdc23.md +46 -0
  163. package/skills/ios/swiftui-performance-audit/references/optimizing-swiftui-performance-instruments.md +29 -0
  164. package/skills/ios/swiftui-performance-audit/references/profiling-intake.md +44 -0
  165. package/skills/ios/swiftui-performance-audit/references/report-template.md +47 -0
  166. package/skills/ios/swiftui-performance-audit/references/understanding-hangs-in-your-app.md +33 -0
  167. package/skills/ios/swiftui-performance-audit/references/understanding-improving-swiftui-performance.md +52 -0
  168. package/skills/ios/swiftui-pro/LICENSE +21 -0
  169. package/skills/ios/swiftui-pro/SKILL.md +108 -0
  170. package/skills/ios/swiftui-pro/agents/openai.yaml +10 -0
  171. package/skills/ios/swiftui-pro/assets/swiftui-pro-icon.png +0 -0
  172. package/skills/ios/swiftui-pro/assets/swiftui-pro-icon.svg +29 -0
  173. package/skills/ios/swiftui-pro/references/accessibility.md +13 -0
  174. package/skills/ios/swiftui-pro/references/api.md +39 -0
  175. package/skills/ios/swiftui-pro/references/data.md +43 -0
  176. package/skills/ios/swiftui-pro/references/design.md +31 -0
  177. package/skills/ios/swiftui-pro/references/hygiene.md +9 -0
  178. package/skills/ios/swiftui-pro/references/navigation.md +14 -0
  179. package/skills/ios/swiftui-pro/references/performance.md +46 -0
  180. package/skills/ios/swiftui-pro/references/swift.md +56 -0
  181. package/skills/ios/swiftui-pro/references/views.md +35 -0
  182. package/skills/ios/swiftui-ui-patterns/LICENSE +21 -0
  183. package/skills/ios/swiftui-ui-patterns/SKILL.md +100 -0
  184. package/skills/ios/swiftui-ui-patterns/agents/openai.yaml +4 -0
  185. package/skills/ios/swiftui-ui-patterns/references/app-wiring.md +201 -0
  186. package/skills/ios/swiftui-ui-patterns/references/async-state.md +96 -0
  187. package/skills/ios/swiftui-ui-patterns/references/components-index.md +50 -0
  188. package/skills/ios/swiftui-ui-patterns/references/controls.md +57 -0
  189. package/skills/ios/swiftui-ui-patterns/references/deeplinks.md +66 -0
  190. package/skills/ios/swiftui-ui-patterns/references/focus.md +90 -0
  191. package/skills/ios/swiftui-ui-patterns/references/form.md +97 -0
  192. package/skills/ios/swiftui-ui-patterns/references/grids.md +71 -0
  193. package/skills/ios/swiftui-ui-patterns/references/haptics.md +71 -0
  194. package/skills/ios/swiftui-ui-patterns/references/input-toolbar.md +51 -0
  195. package/skills/ios/swiftui-ui-patterns/references/lightweight-clients.md +93 -0
  196. package/skills/ios/swiftui-ui-patterns/references/list.md +86 -0
  197. package/skills/ios/swiftui-ui-patterns/references/loading-placeholders.md +38 -0
  198. package/skills/ios/swiftui-ui-patterns/references/macos-settings.md +71 -0
  199. package/skills/ios/swiftui-ui-patterns/references/matched-transitions.md +59 -0
  200. package/skills/ios/swiftui-ui-patterns/references/media.md +73 -0
  201. package/skills/ios/swiftui-ui-patterns/references/menu-bar.md +101 -0
  202. package/skills/ios/swiftui-ui-patterns/references/navigationstack.md +159 -0
  203. package/skills/ios/swiftui-ui-patterns/references/overlay.md +45 -0
  204. package/skills/ios/swiftui-ui-patterns/references/performance.md +62 -0
  205. package/skills/ios/swiftui-ui-patterns/references/previews.md +48 -0
  206. package/skills/ios/swiftui-ui-patterns/references/scroll-reveal.md +133 -0
  207. package/skills/ios/swiftui-ui-patterns/references/scrollview.md +87 -0
  208. package/skills/ios/swiftui-ui-patterns/references/searchable.md +71 -0
  209. package/skills/ios/swiftui-ui-patterns/references/sheets.md +155 -0
  210. package/skills/ios/swiftui-ui-patterns/references/split-views.md +72 -0
  211. package/skills/ios/swiftui-ui-patterns/references/tabview.md +114 -0
  212. package/skills/ios/swiftui-ui-patterns/references/theming.md +71 -0
  213. package/skills/ios/swiftui-ui-patterns/references/title-menus.md +93 -0
  214. package/skills/ios/swiftui-ui-patterns/references/top-bar.md +49 -0
  215. package/skills/ios/swiftui-view-refactor/LICENSE +21 -0
  216. package/skills/ios/swiftui-view-refactor/SKILL.md +207 -0
  217. package/skills/ios/swiftui-view-refactor/agents/openai.yaml +4 -0
  218. package/skills/ios/swiftui-view-refactor/references/mv-patterns.md +161 -0
  219. package/skills/ios/widgetkit/LICENSE +131 -0
  220. package/skills/ios/widgetkit/SKILL.md +502 -0
  221. package/skills/ios/widgetkit/references/widgetkit-advanced.md +871 -0
@@ -0,0 +1,285 @@
1
+ # MLX Swift & llama.cpp Reference
2
+
3
+ Complete reference for running open-source LLMs on Apple platforms using
4
+ MLX Swift and llama.cpp.
5
+
6
+ ## Contents
7
+
8
+ - [MLX Swift](#mlx-swift)
9
+ - [llama.cpp](#llamacpp)
10
+ - [Multi-Backend Architecture](#multi-backend-architecture)
11
+ - [Built-in Apple Frameworks](#built-in-apple-frameworks)
12
+ - [Performance Best Practices](#performance-best-practices)
13
+ - [Review Checklist](#review-checklist)
14
+
15
+ ## MLX Swift
16
+
17
+ Apple's ML framework for Swift. Highest sustained generation throughput on
18
+ Apple Silicon via unified memory architecture.
19
+
20
+ ### Key Characteristics
21
+
22
+ - Unified memory: operations run on CPU or GPU without data transfer
23
+ - Lazy computation: operations computed only when needed
24
+ - Automatic differentiation for training
25
+ - Metal GPU acceleration
26
+ - Research-oriented but increasingly used in production
27
+
28
+ ### Loading and Running LLMs
29
+
30
+ ```swift
31
+ import MLX
32
+ import MLXLLM
33
+
34
+ let config = ModelConfiguration(
35
+ id: "mlx-community/Mistral-7B-Instruct-v0.3-4bit"
36
+ )
37
+ let model = try await LLMModelFactory.shared.loadContainer(
38
+ configuration: config
39
+ )
40
+
41
+ try await model.perform { context in
42
+ let input = try await context.processor.prepare(
43
+ input: UserInput(prompt: "Hello")
44
+ )
45
+ let stream = try generate(
46
+ input: input,
47
+ parameters: GenerateParameters(temperature: 0.0),
48
+ context: context
49
+ )
50
+ for await part in stream {
51
+ print(part.chunk ?? "", terminator: "")
52
+ }
53
+ }
54
+ ```
55
+
56
+ ### Recommended Models by Device
57
+
58
+ | Device | RAM | Recommended Model | Disk Size | RAM Usage |
59
+ |---|---|---|---|---|
60
+ | iPhone 12-14 | 4-6 GB | SmolLM2-135M or Qwen 2.5 0.5B | ~278 MB | ~0.3 GB |
61
+ | iPhone 15 Pro+ | 8 GB | Gemma 3n E4B 4-bit | ~2.7 GB | ~3.5 GB |
62
+ | Mac 8 GB | 8 GB | Llama 3.2 3B 4-bit | ~1.8 GB | ~3 GB |
63
+ | Mac 16 GB+ | 16 GB+ | Mistral 7B 4-bit | ~4 GB | ~6 GB |
64
+
65
+ ### Memory Management Rules
66
+
67
+ 1. Never exceed 60% of total RAM on iOS
68
+ 2. Set GPU cache limits:
69
+ ```swift
70
+ MLX.GPU.set(cacheLimit: 512 * 1024 * 1024) // 512 MB
71
+ ```
72
+ 3. Monitor memory pressure and reduce cache under pressure
73
+ 4. Unload models on app backgrounding
74
+ 5. Use "Increased Memory Limit" entitlement for larger models on iOS
75
+ 6. Pre-flight memory checks before loading models
76
+ 7. Physical device required (no simulator support for Metal GPU)
77
+
78
+ ### Model Lifecycle Management
79
+
80
+ ```swift
81
+ @Observable
82
+ class ModelManager {
83
+ private var model: LLMModelContainer?
84
+ private var generationCount = 0
85
+
86
+ func loadModel() async throws {
87
+ let config = ModelConfiguration(
88
+ id: "mlx-community/Llama-3.2-3B-Instruct-4bit"
89
+ )
90
+ model = try await LLMModelFactory.shared.loadContainer(
91
+ configuration: config
92
+ )
93
+ }
94
+
95
+ func unloadModel() {
96
+ model = nil
97
+ MLX.GPU.set(cacheLimit: 0)
98
+ }
99
+ }
100
+ ```
101
+
102
+ Key lifecycle patterns:
103
+ - Track active generation count to distinguish "loaded but idle" from
104
+ "generating"
105
+ - Unconditional cancellation on app backgrounding
106
+ - 5-second delayed force-unload after backgrounding
107
+ - Platform-specific memory monitoring (UIKit on iOS, DispatchSource on macOS)
108
+
109
+ ### Background Handling
110
+
111
+ ```swift
112
+ // iOS: Observe app lifecycle
113
+ NotificationCenter.default.addObserver(
114
+ forName: UIApplication.didEnterBackgroundNotification,
115
+ object: nil, queue: .main
116
+ ) { _ in
117
+ modelManager.cancelGeneration()
118
+ Task {
119
+ try await Task.sleep(for: .seconds(5))
120
+ modelManager.unloadModel()
121
+ }
122
+ }
123
+ ```
124
+
125
+ ## llama.cpp
126
+
127
+ C/C++ LLM inference engine. Best cross-platform support. Uses GGUF model format.
128
+
129
+ ### Swift Integration (swift-llama-cpp)
130
+
131
+ ```swift
132
+ import SwiftLlamaCpp
133
+
134
+ let service = LlamaService(
135
+ modelUrl: modelURL,
136
+ config: .init(
137
+ batchSize: 256,
138
+ maxTokenCount: 4096,
139
+ useGPU: true
140
+ )
141
+ )
142
+
143
+ let messages = [
144
+ LlamaChatMessage(role: .system, content: "You are helpful."),
145
+ LlamaChatMessage(role: .user, content: "Hello")
146
+ ]
147
+
148
+ let stream = try await service.streamCompletion(
149
+ of: messages,
150
+ samplingConfig: .init(temperature: 0.8)
151
+ )
152
+ for try await token in stream {
153
+ print(token, terminator: "")
154
+ }
155
+ ```
156
+
157
+ ### GGUF Quantization Levels
158
+
159
+ | Level | Quality | Size | Use Case |
160
+ |---|---|---|---|
161
+ | Q2_K | Lowest | Smallest | Extreme memory constraints |
162
+ | Q4_K_M | Good | Balanced | Mobile devices (recommended) |
163
+ | Q5_K_M | Higher | Larger | When quality matters more |
164
+ | Q8_0 | Near-original | Largest | Desktop with ample RAM |
165
+
166
+ ### llama.cpp vs MLX Swift
167
+
168
+ | Aspect | llama.cpp | MLX Swift |
169
+ |---|---|---|
170
+ | Model format | GGUF | Hugging Face / MLX format |
171
+ | Platform support | Cross-platform | Apple only |
172
+ | Throughput (Apple Silicon) | Good | Best |
173
+ | Model ecosystem | Broadest | mlx-community models |
174
+ | Maturity | Very mature | Evolving |
175
+ | Memory efficiency | Excellent | Good |
176
+
177
+ ## Multi-Backend Architecture
178
+
179
+ When an app needs multiple AI backends:
180
+
181
+ ### Fallback Chain Pattern
182
+
183
+ ```swift
184
+ func respond(to prompt: String) async throws -> String {
185
+ // Try Foundation Models first (zero setup, best integration)
186
+ if SystemLanguageModel.default.isAvailable {
187
+ return try await foundationModelsRespond(prompt)
188
+ }
189
+
190
+ // Fall back to MLX Swift (best throughput)
191
+ if canLoadMLXModel() {
192
+ return try await mlxRespond(prompt)
193
+ }
194
+
195
+ // Fall back to llama.cpp (broadest compatibility)
196
+ if llamaModelAvailable() {
197
+ return try await llamaRespond(prompt)
198
+ }
199
+
200
+ throw AIError.noBackendAvailable
201
+ }
202
+ ```
203
+
204
+ ### Architecture Guidelines
205
+
206
+ 1. Create a router that checks Foundation Models availability first
207
+ 2. Fall back to MLX or llama.cpp when Foundation Models is unavailable
208
+ 3. Define model tiers based on device capabilities
209
+ 4. Serialize all model access through a coordinator actor to prevent contention
210
+ 5. Ensure tool systems work across backends (schema translation may be needed)
211
+
212
+ ### Coordinator Actor
213
+
214
+ ```swift
215
+ actor ModelCoordinator {
216
+ private var activeBackend: Backend?
217
+
218
+ func withExclusiveAccess<T>(
219
+ _ work: () async throws -> T
220
+ ) async rethrows -> T {
221
+ try await work()
222
+ }
223
+
224
+ enum Backend {
225
+ case foundationModels
226
+ case mlx
227
+ case llamaCpp
228
+ }
229
+ }
230
+ ```
231
+
232
+ ## Built-in Apple Frameworks
233
+
234
+ Before reaching for custom models, consider built-in frameworks:
235
+
236
+ ### Natural Language Framework
237
+
238
+ No model downloads required:
239
+
240
+ - `NLLanguageRecognizer` -- Language detection
241
+ - `NLTokenizer` -- Word, sentence, paragraph tokenization
242
+ - `NLTagger` -- Parts of speech, named entity recognition, sentiment
243
+ - `NLEmbedding` -- Word and sentence vectors, similarity search
244
+
245
+ ### Vision Framework
246
+
247
+ Built-in computer vision (legacy `VN*` API; for iOS 18+ prefer modern Swift equivalents like `RecognizeTextRequest`):
248
+
249
+ - `VNRecognizeTextRequest` -- OCR
250
+ - `VNClassifyImageRequest` -- Image classification
251
+ - `VNDetectFaceRectanglesRequest` -- Face detection
252
+ - `VNDetectHumanBodyPoseRequest` -- Body pose estimation
253
+
254
+ ### Create ML
255
+
256
+ Training custom classifiers directly on device or Mac:
257
+
258
+ - Image classification
259
+ - Text classification
260
+ - Tabular data models
261
+ - Sound classification
262
+
263
+ ## Performance Best Practices
264
+
265
+ 1. Run outside debugger for accurate benchmarks (Xcode: Cmd-Opt-R, uncheck
266
+ "Debug Executable")
267
+ 2. Use `session.prewarm()` for Foundation Models before user interaction
268
+ 3. Batch Vision framework requests in a single `perform()` call
269
+ 4. Use `.fast` recognition level for real-time camera processing
270
+ 5. Neural Engine (Core ML) is most energy-efficient for compatible operations
271
+ 6. For MLX Swift, monitor token generation speed and adjust model size if
272
+ below acceptable thresholds
273
+
274
+ ## Review Checklist
275
+
276
+ - [ ] Model size appropriate for target device RAM
277
+ - [ ] Memory pressure monitoring implemented
278
+ - [ ] Models unloaded on app backgrounding
279
+ - [ ] GPU cache limits set appropriately
280
+ - [ ] Pre-flight memory check before loading large models
281
+ - [ ] Fallback strategy when model unavailable
282
+ - [ ] All model access serialized through coordinator
283
+ - [ ] Quantization level appropriate for quality/size tradeoff
284
+ - [ ] Energy efficiency considered (Neural Engine vs GPU)
285
+ - [ ] Physical device testing (not simulator) for Metal-dependent code
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: ios-26-platform
3
+ description: Use when implementing iOS 26 APIs EXCEPT Liquid Glass (WebView, Chart3D, @Animatable, toolbar morphing, AlarmKit, FoundationModels, Visual Intelligence), deploying iOS 26+ apps, or supporting backward compatibility with iOS 17/18. For Liquid Glass, see `skills/ios/swiftui-liquid-glass/`.
4
+ ---
5
+
6
+ # iOS 26 Platform
7
+
8
+ iOS 26 introduces new SwiftUI APIs, platform frameworks, and automatic modernization at compile time. This skill covers iOS 26 APIs EXCEPT Liquid Glass.
9
+
10
+ Liquid Glass → see `skills/ios/swiftui-liquid-glass/`
11
+
12
+ ## Overview
13
+
14
+ iOS 26 modernizes UI with new SwiftUI APIs (WebView, Chart3D, @Animatable), and advanced features (@BackoffAnimation, free-form windows). The core principle: modern UI gets updated automatically at compile time from recompiling with Xcode 26.
15
+
16
+ ## Reference Loading Guide
17
+
18
+ **ALWAYS load reference files if there is even a small chance the content may be required.** It's better to have the context than to miss a pattern or make a mistake.
19
+
20
+ | Reference | Load When |
21
+ |-----------|-----------|
22
+ | **Liquid Glass** | → see `skills/ios/swiftui-liquid-glass/` |
23
+ | **[Automatic Adoption](references/automatic-adoption.md)** | Understanding what iOS 26 changes automatically vs what requires code |
24
+ | **[SwiftUI APIs](references/swiftui-apis.md)** | Using WebView, Chart3D, `@Animatable`, AttributedString, or new view modifiers |
25
+ | **[Toolbar & Navigation](references/toolbar-navigation.md)** | Customizing toolbars with spacers, morphing, glass button styles, or search |
26
+ | **[Backward Compatibility](references/backward-compat.md)** | Supporting iOS 17/18 alongside iOS 26, or using UIDesignRequiresCompatibility |
27
+
28
+ ## Core Workflow
29
+
30
+ 1. **Check deployment target** — iOS 26+ required for new APIs
31
+ 2. **Recompile with Xcode 26** — Standard controls get automatic modernization
32
+ 3. **Identify new API opportunities** — WebView, Chart3D, @Animatable, toolbar morphing
33
+ 4. **Add @available guards** — For backward compatibility with iOS 17/18
34
+ 5. **Test accessibility** — Verify Reduce Transparency, Increase Contrast, Reduce Motion
35
+
36
+ Liquid Glass → see `skills/ios/swiftui-liquid-glass/`
37
+
38
+ ## Common Mistakes
39
+
40
+ 1. **Ignoring backward compatibility** — Targeting iOS 26+ without `@available` guards breaks iOS 17/18 support. Always use `if #available(iOS 26, *)` for new APIs.
41
+
42
+ 2. **Animation performance issues** — New iOS 26 animations can be expensive. Respect Reduce Motion accessibility setting and profile with Instruments 26 before shipping.
43
+
44
+ 3. **Not testing on actual devices** — Simulator rendering differs from hardware. Test new visual APIs on iPhone 15 Pro, iPad, and Mac to verify quality.
45
+
46
+ 4. **Using old UIView patterns with new SwiftUI APIs** — Mixing UIView-based navigation with iOS 26 SwiftUI creates inconsistent appearances. Migrate fully to SwiftUI or wrap carefully with UIViewRepresentable.
47
+
48
+ Liquid Glass-specific pitfalls → see `skills/ios/swiftui-liquid-glass/`
49
+
50
+
51
+ ---
52
+
53
+ Vendored from: https://github.com/johnrogers/claude-swift-engineering/tree/main/plugins/swift-engineering/skills/ios-26-platform
@@ -0,0 +1,161 @@
1
+ # Automatic vs Explicit Adoption
2
+
3
+ **iOS 26+**
4
+
5
+ ## What Changes Automatically (Recompile Only)
6
+
7
+ ### Standard Components Get Liquid Glass
8
+ Simply recompile with Xcode 26 — no code changes:
9
+
10
+ ```swift
11
+ // All these get glass automatically:
12
+ NavigationView { ... }
13
+ TabView { ... }
14
+ .toolbar { ... }
15
+ .sheet { ... }
16
+ .popover { ... }
17
+ List { ... }
18
+ ```
19
+
20
+ ### Controls Get New Appearance
21
+ - Toggles, segmented pickers, sliders
22
+ - Knobs transform into glass during interaction
23
+ - Buttons morph into menus/popovers
24
+
25
+ ### Search Placement
26
+ ```swift
27
+ NavigationSplitView {
28
+ List { }
29
+ .searchable(text: $searchText)
30
+ }
31
+ // Automatically:
32
+ // - Bottom-aligned on iPhone (ergonomic)
33
+ // - Top trailing on iPad
34
+ ```
35
+
36
+ ### Performance Improvements
37
+ - **6x faster loading** for 100k+ item lists (macOS)
38
+ - **16x faster updates** for large lists
39
+ - Reduced dropped frames during scrolling
40
+ - Better nested ScrollView performance with lazy stacks
41
+
42
+ ## What Requires Code Changes
43
+
44
+ ### Toolbar Customization
45
+ ```swift
46
+ .toolbar {
47
+ ToolbarItemGroup(placement: .topBarTrailing) {
48
+ Button("Up") { }
49
+ Button("Down") { }
50
+
51
+ Spacer(.fixed) // NEW: Separates button groups
52
+
53
+ Button("Settings") { }
54
+ }
55
+ }
56
+ ```
57
+
58
+ ### Prominent Toolbar Buttons
59
+ ```swift
60
+ Button("Add Trip") {
61
+ addTrip()
62
+ }
63
+ .buttonStyle(.borderedProminent)
64
+ .tint(.blue) // Tinting in glass toolbars
65
+ ```
66
+
67
+ ### Glass Effect for Custom Views
68
+ ```swift
69
+ CustomPhotoGrid()
70
+ .glassBackgroundEffect() // Reflects surrounding content
71
+ ```
72
+
73
+ ### Search Tab Role
74
+ ```swift
75
+ TabView {
76
+ SearchView()
77
+ .tabItem { Label("Search", systemImage: "magnifyingglass") }
78
+ .tabRole(.search) // Separates from tabs, morphs into search
79
+ }
80
+ ```
81
+
82
+ ### Tab Bar Minimization
83
+ ```swift
84
+ TabView { ... }
85
+ .tabBarMinimizationBehavior(.onScrollDown) // Recedes on scroll
86
+ ```
87
+
88
+ ## Audit Checklist
89
+
90
+ ### Remove These (Interfere with Glass)
91
+ ```swift
92
+ // Remove custom backgrounds on navigation
93
+ NavigationView { }
94
+ .background(Color.blue.opacity(0.5)) // Remove
95
+
96
+ // Remove custom blur effects
97
+ .background(
98
+ VisualEffectView(effect: UIBlurEffect(style: .systemMaterial))
99
+ ) // Remove — let system handle
100
+
101
+ // Remove hard-coded dimensions
102
+ Slider(value: $volume)
103
+ .frame(width: 250, height: 44) // Remove — new metrics
104
+ ```
105
+
106
+ ### Update These
107
+ ```swift
108
+ // Section headers: Use title-style capitalization
109
+ Section(header: Text("User Settings")) { } // Not "user settings"
110
+
111
+ // Forms: Use grouped style
112
+ Form { ... }
113
+ .formStyle(.grouped) // Platform-optimized metrics
114
+ ```
115
+
116
+ ## Safe Area Considerations
117
+
118
+ ```swift
119
+ // When glass extends edge-to-edge with .ignoresSafeArea()
120
+ // Use .safeAreaPadding() for content (not .padding())
121
+
122
+ ZStack {
123
+ RoundedRectangle(cornerRadius: 12)
124
+ .fill(.thinMaterial)
125
+ .ignoresSafeArea()
126
+
127
+ VStack {
128
+ content
129
+ }
130
+ .safeAreaPadding(.horizontal, 20) // Respects notch/home indicator
131
+ }
132
+ ```
133
+
134
+ ## Testing Required
135
+
136
+ 1. **Light/dark modes** — Glass adapts independently
137
+ 2. **Reduce Transparency** — Glass becomes frostier
138
+ 3. **Increase Contrast** — Elements become black/white
139
+ 4. **Reduce Motion** — Elastic properties disabled
140
+ 5. **Dynamic Type** — Larger text sizes
141
+ 6. **Content scrolling** — Verify scroll edge effects
142
+
143
+ ## Platform-Specific Changes
144
+
145
+ ### iPad
146
+ - Tab bar can adapt to sidebar
147
+ - Resizable windows (UIRequiresFullscreen deprecated)
148
+ - Menu bar via swipe down
149
+
150
+ ### macOS
151
+ - Synchronized window resize animations
152
+ - Window controls adapt automatically
153
+ - Glassy sidebars reflect content
154
+
155
+ ### watchOS
156
+ - Minimal changes, automatic adoption
157
+ - Use standard toolbar APIs and button styles
158
+
159
+ ### tvOS
160
+ - Focus-based glass appearance
161
+ - Apple TV 4K 2nd gen+ required for full effects