claude-code-session-manager 0.135.1 → 0.136.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.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/assets/{AgentLibrary-BBY7E1ag.js → AgentLibrary-BFztz90B.js} +1 -1
- package/dist/assets/{AppSettings-vMiIi0xn.js → AppSettings-6_dqi9Ti.js} +1 -1
- package/dist/assets/{Button-C0Z090Ui.js → Button-5wbUTtD5.js} +1 -1
- package/dist/assets/{DocumentEditorPane-Ds10W8SZ.js → DocumentEditorPane-CRgJFjka.js} +1 -1
- package/dist/assets/{Extensions-CjPiz2I5.js → Extensions-ZXSJbnK7.js} +2 -2
- package/dist/assets/{History-Bm3KXXs1.js → History-CmSTZeiu.js} +1 -1
- package/dist/assets/{Library-D-khizDg.js → Library-DcTnW9kq.js} +1 -1
- package/dist/assets/{ListDetail-CJYpp8fW.js → ListDetail-BGsdNFiK.js} +1 -1
- package/dist/assets/{Panel-BHFGylfy.js → Panel-BR2PeMf6.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-DIzNAala.js → ProjectClaudeConfig-DJYcUU1G.js} +1 -1
- package/dist/assets/{ProvenanceBadge-CYryeTYF.js → ProvenanceBadge-B_TDAI3k.js} +1 -1
- package/dist/assets/{Scheduler-BS82wfRP.js → Scheduler-DqocyumD.js} +1 -1
- package/dist/assets/{Settings-DWPHJ94d.js → Settings-BzPe2TH6.js} +1 -1
- package/dist/assets/{SkillReferenceGraph-Cf2M7YNq.js → SkillReferenceGraph-DfdO0Q_N.js} +1 -1
- package/dist/assets/{Skills-DLq55Odf.js → Skills-CGPJxKhR.js} +1 -1
- package/dist/assets/{SourceChip-CHxAzRlD.js → SourceChip-CI8xpHRi.js} +1 -1
- package/dist/assets/{SystemPrompt-BYtKMAr3.js → SystemPrompt-BbzGIHoz.js} +1 -1
- package/dist/assets/{TiptapBody-O_Gfq0Ha.js → TiptapBody-CTmjUhAI.js} +1 -1
- package/dist/assets/{Toggle-BJOUI5NY.js → Toggle-CWx9Rq6E.js} +1 -1
- package/dist/assets/{ViewTabs-kkvNGu-S.js → ViewTabs-BnjD0Crp.js} +1 -1
- package/dist/assets/{VoiceButton-3i-6ju2L.js → VoiceButton-C-iQGCL1.js} +1 -1
- package/dist/assets/{historyTotals-CHrIptK1.js → historyTotals-BaxAMu7r.js} +1 -1
- package/dist/assets/{index-CjQ_p5y7.css → index-62tyjEQB.css} +1 -1
- package/dist/assets/index-Cob2iZhR.js +3116 -0
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +412 -412
- package/package.json +1 -1
- package/plugins/CLAUDE.md +2 -0
- package/plugins/packs/apple-design/.claude-plugin/plugin.json +6 -0
- package/plugins/packs/apple-design/laws.md +14 -0
- package/plugins/packs/apple-design/skills/hig-layout-and-accessibility/SKILL.md +152 -0
- package/plugins/packs/apple-design/skills/liquid-glass-adoption/SKILL.md +132 -0
- package/plugins/packs/apple-design/sm-pack.json +5 -0
- package/plugins/packs/apple-swift-core/.claude-plugin/plugin.json +12 -0
- package/plugins/packs/apple-swift-core/laws.md +13 -0
- package/plugins/packs/apple-swift-core/skills/swift-concurrency/SKILL.md +160 -0
- package/plugins/packs/apple-swift-core/skills/swiftui-state-and-navigation/SKILL.md +165 -0
- package/plugins/packs/apple-swift-core/sm-pack.json +5 -0
- package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
- package/plugins/session-manager-dev/skills/builder/SKILL.md +23 -0
- package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +9 -0
- package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +5 -2
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +100 -5
- package/plugins/session-manager-dev/skills/send-feedback/SKILL.md +52 -3
- package/scripts/scheduler-mcp-server.cjs +65 -5
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +26 -2
- package/src/main/index.cjs +4 -0
- package/src/main/ipcSchemas.cjs +13 -0
- package/src/main/lib/claude/agentModelResolve.cjs +23 -0
- package/src/main/lib/epic/epicMint.cjs +12 -6
- package/src/main/lib/epic/promptSessionsCreateEpic.cjs +8 -4
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +201 -8
- package/src/main/lib/feedback-remote/crossProjectReply.cjs +375 -0
- package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +2 -0
- package/src/main/lib/mcpToolCatalog.cjs +38 -4
- package/src/main/lib/mdNetworkScan.cjs +61 -11
- package/src/main/lib/mdReviewRecord.cjs +287 -0
- package/src/main/lib/packs/packCatalog.cjs +120 -0
- package/src/main/lib/packs/packSpawnArgs.cjs +59 -0
- package/src/main/lib/packs/packsIpc.cjs +76 -0
- package/src/main/lib/persona-macro/builtinMacros.cjs +3 -2
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
- package/src/main/lib/prd/prdCreate.cjs +2 -2
- package/src/main/lib/promptSessionSchema.cjs +8 -0
- package/src/main/projectPages.cjs +19 -0
- package/src/main/promptSessionEvents.cjs +8 -1
- package/src/main/scheduler.cjs +23 -2
- package/src/preload/api.d.ts +71 -0
- package/src/preload/apiSurface.json +21 -0
- package/src/preload/index.cjs +7 -0
- package/src/seed/agents/demo-video-builder.md +5 -3
- package/dist/assets/index-D9qgN9_V.js +0 -3116
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-session-manager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.136.0",
|
|
4
4
|
"description": "Local cockpit for the Claude Code CLI — multi-tab terminal, full config surface, scheduler, voice dictation, and live observability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main/index.cjs",
|
package/plugins/CLAUDE.md
CHANGED
|
@@ -9,6 +9,8 @@ Part of the **AGENT LAYER** partition — see
|
|
|
9
9
|
plugins/session-manager-dev/skills` 2026-11-06; keep in sync with `project-partition.md` and
|
|
10
10
|
`seedDevPlugin.cjs`'s header count.
|
|
11
11
|
|
|
12
|
+
`packs/<id>/` — context packs (plugin + `sm-pack.json` + optional `laws.md`), loaded per session by `--plugin-dir`, not the marketplace; read by `src/main/lib/packs/packCatalog.cjs`.
|
|
13
|
+
|
|
12
14
|
Two manifests: root [`.claude-plugin/marketplace.json`](../.claude-plugin/marketplace.json)
|
|
13
15
|
declares the one plugin (`source: "./plugins/session-manager-dev"`); the plugin's own
|
|
14
16
|
[`session-manager-dev/.claude-plugin/plugin.json`](session-manager-dev/.claude-plugin/plugin.json)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sm-pack-apple-design",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Session Manager context pack: always-on Apple Human Interface Guidelines and Liquid Glass rules, plus on-demand skills for adopting Liquid Glass and for HIG layout and accessibility when designing iOS app UI in SwiftUI.",
|
|
5
|
+
"keywords": ["ios", "swiftui", "hig", "liquid-glass", "design", "accessibility", "session-manager-pack"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Use system fonts through text styles (.body, .headline, .title) so every label scales with Dynamic Type; never hard-code point sizes.
|
|
2
|
+
Test layouts at the largest accessibility text sizes; let text wrap and stacks reflow instead of truncating.
|
|
3
|
+
Use SF Symbols before custom icons; match symbol weight and scale to adjacent text.
|
|
4
|
+
Use semantic system colors (Color.primary, .secondary, Color(.systemBackground), .tint) so the UI works in light and dark mode; never hard-code black or white.
|
|
5
|
+
Keep text and icon contrast at or above 4.5:1 in both appearances, and never convey state by color alone.
|
|
6
|
+
Give every tappable element a hit target of at least 44x44 pt, even when the visible glyph is smaller.
|
|
7
|
+
Keep content and controls inside the safe areas; only backgrounds may extend edge to edge.
|
|
8
|
+
Use standard controls (NavigationStack, TabView, List, Toggle, Button, Menu, sheets) before building custom ones.
|
|
9
|
+
Apply Liquid Glass only to the navigation and control layer that floats above content: bars, tab bars, toolbars, floating buttons.
|
|
10
|
+
Never put Liquid Glass on content such as list rows, cards, or media, and never stack glass on glass.
|
|
11
|
+
Tint glass sparingly, only for the one primary action on screen; leave other glass controls untinted.
|
|
12
|
+
Make corner radii concentric with the container: inner radius equals outer radius minus the padding between them.
|
|
13
|
+
Honor Reduce Transparency by replacing glass and blur with opaque fills, and honor Reduce Motion by replacing movement with fades.
|
|
14
|
+
Give every icon-only control an accessibility label, and keep VoiceOver order matching visual order.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hig-layout-and-accessibility
|
|
3
|
+
description: Use when laying out or reviewing SwiftUI iOS screens against the Human Interface Guidelines — typography and Dynamic Type, SF Symbols, semantic colors and dark mode, hit targets, safe areas, standard controls, VoiceOver labels, and Reduce Motion or Reduce Transparency support. Not for non-Swift code.
|
|
4
|
+
paths: ['**/*.swift']
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# HIG layout and accessibility
|
|
8
|
+
|
|
9
|
+
A screen that follows the system conventions gets Dynamic Type, dark mode,
|
|
10
|
+
VoiceOver and right-to-left support mostly for free. Each rule below is about
|
|
11
|
+
not breaking that.
|
|
12
|
+
|
|
13
|
+
## Typography and Dynamic Type
|
|
14
|
+
|
|
15
|
+
Use text styles, never fixed sizes. For custom fonts, scale them relative to a
|
|
16
|
+
text style.
|
|
17
|
+
|
|
18
|
+
```swift
|
|
19
|
+
// Do
|
|
20
|
+
Text(title).font(.headline)
|
|
21
|
+
Text(body).font(.body)
|
|
22
|
+
Text(price).font(.custom("Brand", size: 17, relativeTo: .body))
|
|
23
|
+
|
|
24
|
+
// Don't — ignores the user's text size
|
|
25
|
+
Text(title).font(.system(size: 17, weight: .semibold))
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Let layouts reflow at accessibility sizes instead of truncating:
|
|
29
|
+
|
|
30
|
+
```swift
|
|
31
|
+
@Environment(\.dynamicTypeSize) private var typeSize
|
|
32
|
+
|
|
33
|
+
let layout = typeSize.isAccessibilitySize
|
|
34
|
+
? AnyLayout(VStackLayout(alignment: .leading))
|
|
35
|
+
: AnyLayout(HStackLayout())
|
|
36
|
+
layout { Label("Due", systemImage: "calendar"); Text(date) }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Scale fixed spacing and image sizes with `@ScaledMetric`.
|
|
40
|
+
|
|
41
|
+
## Icons: SF Symbols first
|
|
42
|
+
|
|
43
|
+
```swift
|
|
44
|
+
// Do — scales with text, adapts weight, supports variants
|
|
45
|
+
Label("Favorites", systemImage: "heart.fill")
|
|
46
|
+
Image(systemName: "bell.badge").symbolRenderingMode(.hierarchical)
|
|
47
|
+
|
|
48
|
+
// Don't — a fixed-size bitmap that ignores Dynamic Type
|
|
49
|
+
Image("heart_icon_24").resizable().frame(width: 24, height: 24)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Draw a custom icon only when no symbol fits, and export it as a custom symbol.
|
|
53
|
+
|
|
54
|
+
## Color and dark mode
|
|
55
|
+
|
|
56
|
+
```swift
|
|
57
|
+
// Do
|
|
58
|
+
.foregroundStyle(.primary)
|
|
59
|
+
.foregroundStyle(.secondary)
|
|
60
|
+
.background(Color(.systemGroupedBackground))
|
|
61
|
+
.tint(.accentColor)
|
|
62
|
+
|
|
63
|
+
// Don't — invisible or harsh in one of the two appearances
|
|
64
|
+
.foregroundColor(.black)
|
|
65
|
+
.background(Color(red: 1, green: 1, blue: 1))
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Brand colors go in the asset catalog with light, dark and high-contrast
|
|
69
|
+
variants. Never show state with color alone — pair it with a symbol or text.
|
|
70
|
+
|
|
71
|
+
## Hit targets
|
|
72
|
+
|
|
73
|
+
Every tappable element needs at least 44x44 pt, even if the glyph is smaller.
|
|
74
|
+
|
|
75
|
+
```swift
|
|
76
|
+
// Do
|
|
77
|
+
Button { close() } label: {
|
|
78
|
+
Image(systemName: "xmark")
|
|
79
|
+
.frame(minWidth: 44, minHeight: 44)
|
|
80
|
+
.contentShape(Rectangle())
|
|
81
|
+
}
|
|
82
|
+
.accessibilityLabel("Close")
|
|
83
|
+
|
|
84
|
+
// Don't — a 16 pt target that is hard to hit
|
|
85
|
+
Image(systemName: "xmark").onTapGesture { close() }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Prefer `Button` over `onTapGesture`: it brings the button trait, focus,
|
|
89
|
+
keyboard and pointer support.
|
|
90
|
+
|
|
91
|
+
## Safe areas and layout
|
|
92
|
+
|
|
93
|
+
Content and controls stay inside the safe area; only backgrounds bleed.
|
|
94
|
+
|
|
95
|
+
```swift
|
|
96
|
+
// Do
|
|
97
|
+
VStack { Header(); Content() }
|
|
98
|
+
.background(Color(.systemBackground).ignoresSafeArea())
|
|
99
|
+
|
|
100
|
+
// Don't — buttons slide under the Dynamic Island and home indicator
|
|
101
|
+
VStack { Header(); Content() }.ignoresSafeArea()
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Use `safeAreaInset(edge:)` for bars you add yourself, and system margins
|
|
105
|
+
(`.padding()`, `.scenePadding()`, `.contentMargins`) instead of magic numbers.
|
|
106
|
+
Use leading/trailing, never left/right, so right-to-left languages flip.
|
|
107
|
+
|
|
108
|
+
## Standard controls first
|
|
109
|
+
|
|
110
|
+
`NavigationStack`, `TabView`, `List`, `Form`, `Toggle`, `Picker`, `Menu`,
|
|
111
|
+
`.sheet`, `.confirmationDialog`, `.searchable` — each already handles
|
|
112
|
+
accessibility, keyboard, dark mode and the current design. Build a custom
|
|
113
|
+
control only when no standard one expresses the interaction, and then give it
|
|
114
|
+
the matching accessibility traits.
|
|
115
|
+
|
|
116
|
+
```swift
|
|
117
|
+
// Do
|
|
118
|
+
Toggle("Notifications", isOn: $notify)
|
|
119
|
+
|
|
120
|
+
// Don't — a hand-rolled switch VoiceOver cannot operate
|
|
121
|
+
HStack { Text("Notifications"); Capsule().fill(notify ? .green : .gray) }
|
|
122
|
+
.onTapGesture { notify.toggle() }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## VoiceOver
|
|
126
|
+
|
|
127
|
+
- Give every icon-only control an `.accessibilityLabel`.
|
|
128
|
+
- Group a composite row with `.accessibilityElement(children: .combine)`.
|
|
129
|
+
- Hide pure decoration with `.accessibilityHidden(true)`.
|
|
130
|
+
- Keep the reading order equal to the visual order.
|
|
131
|
+
|
|
132
|
+
## Reduce Motion and Reduce Transparency
|
|
133
|
+
|
|
134
|
+
```swift
|
|
135
|
+
@Environment(\.accessibilityReduceMotion) private var reduceMotion
|
|
136
|
+
@Environment(\.accessibilityReduceTransparency) private var reduceTransparency
|
|
137
|
+
|
|
138
|
+
.transition(reduceMotion ? .opacity : .move(edge: .bottom))
|
|
139
|
+
.background(reduceTransparency ? AnyShapeStyle(Color(.systemBackground))
|
|
140
|
+
: AnyShapeStyle(.regularMaterial))
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Review checklist
|
|
144
|
+
|
|
145
|
+
- [ ] No fixed font sizes; layout checked at the largest accessibility size.
|
|
146
|
+
- [ ] SF Symbols used wherever one fits.
|
|
147
|
+
- [ ] Only semantic or asset-catalog colors; checked in light and dark.
|
|
148
|
+
- [ ] Every tap target at least 44x44 pt.
|
|
149
|
+
- [ ] Controls inside the safe area.
|
|
150
|
+
- [ ] Standard controls unless none fits.
|
|
151
|
+
- [ ] Icon-only controls labeled; VoiceOver order matches the screen.
|
|
152
|
+
- [ ] Reduce Motion and Reduce Transparency honored.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: liquid-glass-adoption
|
|
3
|
+
description: Use when adding, reviewing or fixing Liquid Glass in a SwiftUI iOS app — glassEffect, GlassEffectContainer, glass button styles, tinted glass, toolbars and tab bars that float over content, or migrating custom blur/material chrome to the iOS 26 design. Not for non-Swift code.
|
|
4
|
+
paths: ['**/*.swift']
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Liquid Glass adoption
|
|
8
|
+
|
|
9
|
+
Liquid Glass is a material for the **control layer**: the navigation and
|
|
10
|
+
controls that float above the content. Content stays opaque and readable
|
|
11
|
+
underneath; glass lets it show through the chrome.
|
|
12
|
+
|
|
13
|
+
## 1. Let the system do it first
|
|
14
|
+
|
|
15
|
+
Standard containers adopt glass on their own when built with the current SDK:
|
|
16
|
+
`NavigationStack` bars, `TabView` tab bars, `.toolbar` items, sheets, menus,
|
|
17
|
+
and `Button` styles. Before writing any `glassEffect`, remove custom
|
|
18
|
+
backgrounds you added to those containers — they hide the system glass.
|
|
19
|
+
|
|
20
|
+
```swift
|
|
21
|
+
// Don't — paints over the system bar material
|
|
22
|
+
.toolbarBackground(Color.white, for: .navigationBar)
|
|
23
|
+
.background(.ultraThinMaterial)
|
|
24
|
+
|
|
25
|
+
// Do — keep standard chrome, let the system render glass
|
|
26
|
+
NavigationStack {
|
|
27
|
+
List(items) { ItemRow(item: $0) }
|
|
28
|
+
.navigationTitle("Library")
|
|
29
|
+
.toolbar { ToolbarItem { Button("Add", systemImage: "plus") { add() } } }
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 2. Custom floating controls
|
|
34
|
+
|
|
35
|
+
Use `glassEffect` only for a control that floats over content and has no
|
|
36
|
+
standard equivalent.
|
|
37
|
+
|
|
38
|
+
```swift
|
|
39
|
+
// Do — one floating control, glass in a capsule
|
|
40
|
+
Button { record() } label: { Label("Record", systemImage: "mic.fill") }
|
|
41
|
+
.padding()
|
|
42
|
+
.glassEffect(.regular.interactive(), in: .capsule)
|
|
43
|
+
|
|
44
|
+
// Don't — glass on content
|
|
45
|
+
ForEach(photos) { photo in
|
|
46
|
+
PhotoCard(photo: photo)
|
|
47
|
+
.glassEffect() // cards are content, keep them opaque
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 3. Never glass on glass
|
|
52
|
+
|
|
53
|
+
Glass cannot sample other glass. When several glass controls sit together,
|
|
54
|
+
wrap them in one `GlassEffectContainer` so they render as one surface and can
|
|
55
|
+
merge and morph.
|
|
56
|
+
|
|
57
|
+
```swift
|
|
58
|
+
// Do
|
|
59
|
+
GlassEffectContainer(spacing: 12) {
|
|
60
|
+
HStack(spacing: 12) {
|
|
61
|
+
Button("Undo", systemImage: "arrow.uturn.backward") { undo() }
|
|
62
|
+
.glassEffect()
|
|
63
|
+
Button("Redo", systemImage: "arrow.uturn.forward") { redo() }
|
|
64
|
+
.glassEffect()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Don't — a glass button inside a glass panel
|
|
69
|
+
VStack { Button("Done") { } .glassEffect() }
|
|
70
|
+
.padding()
|
|
71
|
+
.glassEffect(in: .rect(cornerRadius: 24))
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
To animate controls appearing or merging, give each one a
|
|
75
|
+
`glassEffectID(_:in:)` with a shared `@Namespace` inside the container.
|
|
76
|
+
|
|
77
|
+
## 4. Tint for the primary action only
|
|
78
|
+
|
|
79
|
+
Tint means "this is the main thing to do here". One tinted control per screen
|
|
80
|
+
is the norm; tinting everything removes the signal.
|
|
81
|
+
|
|
82
|
+
```swift
|
|
83
|
+
// Do
|
|
84
|
+
Button("Checkout") { checkout() }
|
|
85
|
+
.buttonStyle(.glassProminent)
|
|
86
|
+
.tint(.accentColor)
|
|
87
|
+
Button("Save for later") { save() }
|
|
88
|
+
.buttonStyle(.glass)
|
|
89
|
+
|
|
90
|
+
// Don't — every control shouts
|
|
91
|
+
Button("Share") { }.glassEffect(.regular.tint(.blue))
|
|
92
|
+
Button("Edit") { }.glassEffect(.regular.tint(.orange))
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 5. Shapes and spacing
|
|
96
|
+
|
|
97
|
+
- Prefer `.capsule` and `.circle` for small controls.
|
|
98
|
+
- For rectangles, make the radius concentric with what contains it: inner
|
|
99
|
+
radius = outer radius − padding. `ConcentricRectangle` or
|
|
100
|
+
`.rect(cornerRadius:)` computed from the container both work.
|
|
101
|
+
- Keep glass controls clear of content they would obscure; use
|
|
102
|
+
`safeAreaInset(edge:)` so scroll content can scroll under them but still
|
|
103
|
+
reach the end.
|
|
104
|
+
|
|
105
|
+
```swift
|
|
106
|
+
// Do — content scrolls under the floating bar and stays reachable
|
|
107
|
+
ScrollView { Feed() }
|
|
108
|
+
.safeAreaInset(edge: .bottom) { ComposerBar().glassEffect(in: .capsule) }
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 6. Accessibility
|
|
112
|
+
|
|
113
|
+
Glass already adapts to Reduce Transparency and Increase Contrast when you use
|
|
114
|
+
system APIs. For custom fills you draw yourself, check the environment:
|
|
115
|
+
|
|
116
|
+
```swift
|
|
117
|
+
@Environment(\.accessibilityReduceTransparency) private var reduceTransparency
|
|
118
|
+
|
|
119
|
+
.background(reduceTransparency ? Color(.secondarySystemBackground) : .clear)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Under Reduce Motion, skip morph animations and use a plain fade:
|
|
123
|
+
`withAnimation(reduceMotion ? .easeInOut : .bouncy) { … }`.
|
|
124
|
+
|
|
125
|
+
## Review checklist
|
|
126
|
+
|
|
127
|
+
- [ ] No glass on rows, cards, images or text blocks.
|
|
128
|
+
- [ ] No glass nested inside glass; grouped glass lives in one container.
|
|
129
|
+
- [ ] At most one tinted / prominent glass control per screen.
|
|
130
|
+
- [ ] Custom bar backgrounds removed from standard containers.
|
|
131
|
+
- [ ] Corner radii concentric with the container.
|
|
132
|
+
- [ ] Checked with Reduce Transparency, Increase Contrast and Reduce Motion on.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "apple-design",
|
|
3
|
+
"label": "Apple · Design",
|
|
4
|
+
"description": "Human Interface Guidelines and Liquid Glass rules for iOS app UI: system type, SF Symbols, semantic colors, hit targets, safe areas, standard controls, glass on the control layer only, and accessibility settings. Adds skills for Liquid Glass adoption and HIG layout."
|
|
5
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sm-pack-apple-swift-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Session Manager context pack: always-on Swift 6 and SwiftUI rules plus on-demand skills for SwiftUI state, navigation and Swift concurrency when building iOS apps.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Bilko Bibitkov",
|
|
7
|
+
"email": "BilkoBibitkov2000@gmail.com",
|
|
8
|
+
"url": "https://bilko.run"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/StanislavBG/claude-code-session-manager",
|
|
11
|
+
"keywords": ["swift", "swiftui", "ios", "concurrency", "context-pack", "session-manager"]
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
- Target Swift 6 with strict concurrency checking on; fix every data-race warning, never silence it with @unchecked Sendable or nonisolated(unsafe) without a written reason.
|
|
2
|
+
- Make types that cross actor or task boundaries Sendable; prefer immutable structs and enums for model values.
|
|
3
|
+
- Mark UI state, view models and anything touching UIKit/SwiftUI with @MainActor.
|
|
4
|
+
- Use the @Observable macro for shared state; never write new ObservableObject, @Published or @StateObject code.
|
|
5
|
+
- Build UI in SwiftUI first; drop to UIKit only through UIViewRepresentable when SwiftUI has no equivalent.
|
|
6
|
+
- Use NavigationStack (or NavigationSplitView) with value-based navigationDestination; never use NavigationView.
|
|
7
|
+
- Use async/await and structured concurrency (async let, TaskGroup, .task); never add new completion-handler or DispatchQueue code.
|
|
8
|
+
- Persist app data with SwiftData; use @AppStorage only for small user preferences.
|
|
9
|
+
- Never force unwrap (!) or force try (try!); use if let, guard let, ?? or throw a typed error.
|
|
10
|
+
- Give every SwiftUI view a #Preview that renders it with realistic sample data.
|
|
11
|
+
- Give every custom control an accessibilityLabel (plus accessibilityHint or value where it helps) and support Dynamic Type.
|
|
12
|
+
- Put every user-facing string in a String Catalog (Localizable.xcstrings); never hard-code display text outside it.
|
|
13
|
+
- Keep views small: extract a subview once a body grows past one screen.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: swift-concurrency
|
|
3
|
+
description: >-
|
|
4
|
+
Use when writing or fixing asynchronous Swift code in an iOS app — async/await,
|
|
5
|
+
Task and TaskGroup, actors, @MainActor isolation, Sendable conformance, or
|
|
6
|
+
Swift 6 strict-concurrency compiler errors such as data-race and
|
|
7
|
+
non-Sendable warnings. Not for non-Swift code.
|
|
8
|
+
paths: ['**/*.swift']
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Swift concurrency (Swift 6)
|
|
12
|
+
|
|
13
|
+
Make isolation explicit, keep work structured, and let the compiler prove there
|
|
14
|
+
are no data races.
|
|
15
|
+
|
|
16
|
+
## Isolation basics
|
|
17
|
+
|
|
18
|
+
- UI state and view models are `@MainActor`.
|
|
19
|
+
- Shared mutable state that is not UI lives in an `actor`.
|
|
20
|
+
- Values passed between isolation domains are `Sendable` (structs/enums of Sendable fields are automatic).
|
|
21
|
+
- `nonisolated` marks members that touch no isolated state.
|
|
22
|
+
|
|
23
|
+
### Do
|
|
24
|
+
|
|
25
|
+
```swift
|
|
26
|
+
struct Article: Sendable, Identifiable, Decodable {
|
|
27
|
+
let id: Int
|
|
28
|
+
let title: String
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
actor ArticleCache {
|
|
32
|
+
private var byID: [Int: Article] = [:]
|
|
33
|
+
func store(_ items: [Article]) { for a in items { byID[a.id] = a } }
|
|
34
|
+
func article(_ id: Int) -> Article? { byID[id] }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Observable @MainActor
|
|
38
|
+
final class FeedModel {
|
|
39
|
+
private(set) var articles: [Article] = []
|
|
40
|
+
private(set) var error: String?
|
|
41
|
+
private let client: APIClient
|
|
42
|
+
|
|
43
|
+
init(client: APIClient) { self.client = client }
|
|
44
|
+
|
|
45
|
+
func load() async {
|
|
46
|
+
do {
|
|
47
|
+
articles = try await client.articles()
|
|
48
|
+
} catch {
|
|
49
|
+
self.error = error.localizedDescription
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Don't
|
|
56
|
+
|
|
57
|
+
```swift
|
|
58
|
+
final class FeedModel {
|
|
59
|
+
var articles: [Article] = [] // mutated from any thread
|
|
60
|
+
func load() {
|
|
61
|
+
DispatchQueue.global().async {
|
|
62
|
+
let data = try! Data(contentsOf: url) // blocking + force try
|
|
63
|
+
self.articles = decode(data) // data race, off main thread
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Starting work from SwiftUI
|
|
70
|
+
|
|
71
|
+
Prefer the `.task` modifier: it runs on appear and is cancelled on disappear.
|
|
72
|
+
|
|
73
|
+
```swift
|
|
74
|
+
struct FeedView: View {
|
|
75
|
+
@State private var model: FeedModel
|
|
76
|
+
var body: some View {
|
|
77
|
+
List(model.articles) { Text($0.title) }
|
|
78
|
+
.task { await model.load() }
|
|
79
|
+
.refreshable { await model.load() }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Use `.task(id:)` to restart work when an input changes (for example a search
|
|
85
|
+
query). Avoid a bare `Task { }` in `onAppear` — nothing cancels it.
|
|
86
|
+
|
|
87
|
+
## Structured concurrency
|
|
88
|
+
|
|
89
|
+
Run independent work in parallel with `async let` or a task group; children are
|
|
90
|
+
cancelled automatically when the parent ends or throws.
|
|
91
|
+
|
|
92
|
+
### Do
|
|
93
|
+
|
|
94
|
+
```swift
|
|
95
|
+
func dashboard() async throws -> Dashboard {
|
|
96
|
+
async let profile = client.profile()
|
|
97
|
+
async let stats = client.stats()
|
|
98
|
+
return try await Dashboard(profile: profile, stats: stats)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
func thumbnails(for ids: [Int]) async throws -> [Int: Image] {
|
|
102
|
+
try await withThrowingTaskGroup(of: (Int, Image).self) { group in
|
|
103
|
+
for id in ids { group.addTask { (id, try await client.thumbnail(id)) } }
|
|
104
|
+
var result: [Int: Image] = [:]
|
|
105
|
+
for try await (id, image) in group { result[id] = image }
|
|
106
|
+
return result
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Don't
|
|
112
|
+
|
|
113
|
+
```swift
|
|
114
|
+
for id in ids {
|
|
115
|
+
Task { images[id] = try? await client.thumbnail(id) } // unstructured, racy, errors dropped
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Wrapping callback APIs
|
|
120
|
+
|
|
121
|
+
Bridge a completion-handler API once, with a checked continuation, and resume
|
|
122
|
+
it exactly once on every path.
|
|
123
|
+
|
|
124
|
+
```swift
|
|
125
|
+
func currentLocation() async throws -> CLLocation {
|
|
126
|
+
try await withCheckedThrowingContinuation { continuation in
|
|
127
|
+
locator.requestOnce { result in
|
|
128
|
+
continuation.resume(with: result)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
For streams of values, wrap the delegate or callback in an `AsyncStream` and
|
|
135
|
+
consume it with `for await`.
|
|
136
|
+
|
|
137
|
+
## Cancellation
|
|
138
|
+
|
|
139
|
+
- Check `try Task.checkCancellation()` or `Task.isCancelled` inside long loops.
|
|
140
|
+
- Don't swallow `CancellationError` as a user-visible failure.
|
|
141
|
+
- Keep a `Task` handle only when you must cancel it manually; store it and call `cancel()` in teardown.
|
|
142
|
+
|
|
143
|
+
## Fixing strict-concurrency errors
|
|
144
|
+
|
|
145
|
+
| Compiler says | Usual fix |
|
|
146
|
+
| --- | --- |
|
|
147
|
+
| "Main actor-isolated property … from a nonisolated context" | Mark the caller `@MainActor`, or `await` the access. |
|
|
148
|
+
| "Type … does not conform to Sendable" | Make it a value type with Sendable fields, an `actor`, or `@MainActor`-isolate the class. |
|
|
149
|
+
| "Capture of non-Sendable … in a @Sendable closure" | Copy the needed values into `let`s first, or keep the work on one actor. |
|
|
150
|
+
| "Sending … risks causing data races" | Don't use the value after handing it to another task; pass a copy. |
|
|
151
|
+
|
|
152
|
+
Reach for `@unchecked Sendable` or `nonisolated(unsafe)` only when the type is
|
|
153
|
+
truly protected by a lock you own, and leave a comment saying which lock.
|
|
154
|
+
|
|
155
|
+
## Checklist before you finish
|
|
156
|
+
|
|
157
|
+
- No new `DispatchQueue`, completion handlers, or `try!`.
|
|
158
|
+
- Every UI-facing type is `@MainActor`; cross-boundary types are `Sendable`.
|
|
159
|
+
- Async work from views uses `.task`; parallel work uses `async let` or a task group.
|
|
160
|
+
- The project builds with no concurrency warnings in Swift 6 mode.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: swiftui-state-and-navigation
|
|
3
|
+
description: >-
|
|
4
|
+
Use when writing or changing SwiftUI views in an iOS app — choosing between
|
|
5
|
+
@State, @Binding, @Bindable, @Environment and @Observable models, passing
|
|
6
|
+
state between screens, or building navigation with NavigationStack,
|
|
7
|
+
navigationDestination, sheets and programmatic paths. Not for non-Swift code.
|
|
8
|
+
paths: ['**/*.swift']
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# SwiftUI state and navigation
|
|
12
|
+
|
|
13
|
+
Pick the smallest owner for each piece of state, and drive navigation from data.
|
|
14
|
+
|
|
15
|
+
## Who owns the state
|
|
16
|
+
|
|
17
|
+
| Need | Use |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Value local to one view (toggle, text field) | `@State private var` |
|
|
20
|
+
| Child edits a parent's value | `@Binding` |
|
|
21
|
+
| Shared model object owned by a view | `@State private var model = Model()` with an `@Observable` class |
|
|
22
|
+
| Child needs bindings into an `@Observable` object | `@Bindable var model` |
|
|
23
|
+
| App-wide dependency (store, router, settings) | `.environment(model)` + `@Environment(Model.self)` |
|
|
24
|
+
| Small persisted preference | `@AppStorage("key")` |
|
|
25
|
+
|
|
26
|
+
### Do
|
|
27
|
+
|
|
28
|
+
```swift
|
|
29
|
+
@Observable @MainActor
|
|
30
|
+
final class CounterModel {
|
|
31
|
+
var count = 0
|
|
32
|
+
func increment() { count += 1 }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
struct CounterView: View {
|
|
36
|
+
@State private var model = CounterModel()
|
|
37
|
+
var body: some View {
|
|
38
|
+
Button("Count: \(model.count)") { model.increment() }
|
|
39
|
+
.accessibilityLabel("Increment counter")
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#Preview { CounterView() }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Don't
|
|
47
|
+
|
|
48
|
+
```swift
|
|
49
|
+
final class CounterModel: ObservableObject { // legacy pattern
|
|
50
|
+
@Published var count = 0
|
|
51
|
+
}
|
|
52
|
+
struct CounterView: View {
|
|
53
|
+
@ObservedObject var model = CounterModel() // re-created on every parent redraw
|
|
54
|
+
var body: some View { Text("\(model.count)") }
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Rules of thumb:
|
|
59
|
+
|
|
60
|
+
- Keep `@State` `private`; it belongs to the view that declares it.
|
|
61
|
+
- Create an `@Observable` model in exactly one place (`@State` or app entry) and pass it down.
|
|
62
|
+
- Use `@Bindable` only when you need `$model.field` bindings; plain `let model` is enough to read.
|
|
63
|
+
- Don't copy model values into `@State` in `init` — it silently stops tracking the source.
|
|
64
|
+
- Derive values with computed properties instead of storing duplicates that drift.
|
|
65
|
+
|
|
66
|
+
## Navigation
|
|
67
|
+
|
|
68
|
+
Use one `NavigationStack` per navigation hierarchy, at the root of the tab or
|
|
69
|
+
scene, and drive it with values.
|
|
70
|
+
|
|
71
|
+
### Do
|
|
72
|
+
|
|
73
|
+
```swift
|
|
74
|
+
enum Route: Hashable {
|
|
75
|
+
case detail(Item.ID)
|
|
76
|
+
case settings
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@Observable @MainActor
|
|
80
|
+
final class Router {
|
|
81
|
+
var path: [Route] = []
|
|
82
|
+
func show(_ route: Route) { path.append(route) }
|
|
83
|
+
func popToRoot() { path.removeAll() }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
struct RootView: View {
|
|
87
|
+
@State private var router = Router()
|
|
88
|
+
var body: some View {
|
|
89
|
+
NavigationStack(path: $router.path) {
|
|
90
|
+
ItemList()
|
|
91
|
+
.navigationDestination(for: Route.self) { route in
|
|
92
|
+
switch route {
|
|
93
|
+
case .detail(let id): ItemDetail(id: id)
|
|
94
|
+
case .settings: SettingsView()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
.environment(router)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
struct ItemRow: View {
|
|
103
|
+
let item: Item
|
|
104
|
+
var body: some View {
|
|
105
|
+
NavigationLink(value: Route.detail(item.id)) { Text(item.title) }
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Don't
|
|
111
|
+
|
|
112
|
+
```swift
|
|
113
|
+
NavigationView { // deprecated
|
|
114
|
+
List(items) { item in
|
|
115
|
+
NavigationLink(destination: ItemDetail(item: item)) { // builds every destination eagerly
|
|
116
|
+
Text(item.title)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Rules of thumb:
|
|
123
|
+
|
|
124
|
+
- Never use `NavigationView`; use `NavigationStack`, or `NavigationSplitView` for sidebar layouts on iPad and Mac.
|
|
125
|
+
- Register `navigationDestination(for:)` once per value type, near the stack root, not inside a lazy row.
|
|
126
|
+
- Push identifiers (`Item.ID`) rather than whole mutable models, so deep links and state restoration work.
|
|
127
|
+
- Don't nest a `NavigationStack` inside another one; a pushed view inherits the parent stack.
|
|
128
|
+
- Present modals with `.sheet(item:)` bound to optional state; dismiss with `@Environment(\.dismiss)`.
|
|
129
|
+
- Keep tab selection in an enum: `TabView(selection: $tab)` with one `NavigationStack` inside each tab.
|
|
130
|
+
|
|
131
|
+
## Sheets
|
|
132
|
+
|
|
133
|
+
```swift
|
|
134
|
+
struct ItemList: View {
|
|
135
|
+
@State private var editing: Item?
|
|
136
|
+
var body: some View {
|
|
137
|
+
List(items) { item in
|
|
138
|
+
Button(item.title) { editing = item }
|
|
139
|
+
}
|
|
140
|
+
.sheet(item: $editing) { item in EditItemView(item: item) }
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Avoid a separate `isPresented` Bool plus a second optional for the same sheet —
|
|
146
|
+
the two drift apart and the sheet opens with stale data.
|
|
147
|
+
|
|
148
|
+
## Previews
|
|
149
|
+
|
|
150
|
+
Give each view a `#Preview` with sample data. For views that read the
|
|
151
|
+
environment, inject it in the preview:
|
|
152
|
+
|
|
153
|
+
```swift
|
|
154
|
+
#Preview {
|
|
155
|
+
NavigationStack { ItemList() }
|
|
156
|
+
.environment(Router())
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Checklist before you finish
|
|
161
|
+
|
|
162
|
+
- No `ObservableObject`, `@Published`, `@StateObject`, `@ObservedObject` in new code.
|
|
163
|
+
- No `NavigationView`; navigation is value-based.
|
|
164
|
+
- Each view has a `#Preview`; custom controls have `accessibilityLabel`.
|
|
165
|
+
- User-facing strings come from the String Catalog.
|