From ce79ef24dac5a9c54d09a30f642ad3cd697a0c63 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Sun, 15 Mar 2026 10:40:22 +0100 Subject: [PATCH] Enhance SKILL.md with fallback guidance for iOS 16 and earlier. Added recommendation to use `ObservableObject` with appropriate ownership attributes when the Observation API is unavailable. --- .DS_Store | Bin 0 -> 6148 bytes swiftui-ui-patterns/SKILL.md | 1 + 2 files changed, 1 insertion(+) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7c951aea124058242530ca12b5d8c58fc785af99 GIT binary patch literal 6148 zcmeHK%}N6?5T4X(yNFOwp~ryNinabg@v>BX0ax^(Qg><9#dTAauw;T9)ew#1=A3Z7bVF)oKL7ohPNClYj5)7g+Nt?}AQCcW3E>$W{ zWw~YFV*3 zfoC+nx!Xr?7)L6;#f-^plUW#<0cL<1n0E&3y;fbG_l@xHX9k#oA7_B>2Z>7PS}Y9e zs{_mLQZCU5kZ596=E#715*$`@|3?9sSbAxfTn9CLM%c8RxMp3;RM5 zdUf@I3_$U5YW5N^u=k3;HD)h_1!LAbL>vLqOBO4Kwho47>p$`&8Nh literal 0 HcmV?d00001 diff --git a/swiftui-ui-patterns/SKILL.md b/swiftui-ui-patterns/SKILL.md index fe309df..e39b7b8 100644 --- a/swiftui-ui-patterns/SKILL.md +++ b/swiftui-ui-patterns/SKILL.md @@ -28,6 +28,7 @@ Choose a track based on your goal: ## General rules to follow - Use modern SwiftUI state (`@State`, `@Binding`, `@Observable`, `@Environment`) and avoid unnecessary view models. +- If the deployment target includes iOS 16 or earlier and cannot use the Observation API introduced in iOS 17, fall back to `ObservableObject` with `@StateObject` for root ownership, `@ObservedObject` for injected observation, and `@EnvironmentObject` only for truly shared app-level state. - Prefer composition; keep views small and focused. - Use async/await with `.task` and explicit loading/error states. - Maintain existing legacy patterns only when editing legacy files.