Files
scarf/scarf/Scarf iOS/Memory/MemoryListView.swift
T
Alan Wizemann 5f9343be5d M8: list density tokens (scarfGoCompactListRow + scarfGoListDensity)
Apple's default List styling targets Reading/Notes-style apps:
~60pt rows, 10pt inter-row spacing, big vertical padding on
grouped cells. ScarfGo's lists (Memory, Cron, Skills, More,
Dashboard recent sessions) lean information-dense — devs want to
see 4-6 items per screen, not 2.

Two tokens in Scarf iOS/App/Theme/ListDensity.swift:

- `.scarfGoCompactListRow()` — 6pt vertical listRowInsets (down
  from default ~12pt), explicit `.frame(minHeight: 44)` to preserve
  the Apple HIG tap target, and `.contentShape(Rectangle())` so
  rows can shrink below 44pt visually while keeping the full-row
  hit area. ~48pt rows end up net, vs. ~60pt default.
- `.scarfGoListDensity()` — `.listRowSpacing(0)` kills inter-row
  gaps on the whole List, `.defaultMinListRowHeight(36)` sets the
  floor for rows that want to go smaller (e.g. `LabeledContent`).

Applied to Memory, Cron, Skills, Dashboard, MoreTab. No visual
change to Chat (it's not a List — different density patterns for
M8 items 2.4–2.7). Research-backed: Fantastical / GitHub Mobile /
Mona for Mastodon use similar spacing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 13:40:10 +02:00

60 lines
2.1 KiB
Swift

import SwiftUI
import ScarfCore
/// Entry screen for the Memory feature. Three rows: MEMORY.md,
/// USER.md, and SOUL.md (persona). SOUL lives in the Personalities
/// feature on macOS; we fold it in here on iOS so the whole
/// "agent prompt inputs" surface is one tap away. Each row taps into
/// `MemoryEditorView`. Pure SwiftUI the actual load/save happens in
/// `IOSMemoryViewModel` which lives in ScarfCore.
struct MemoryListView: View {
let config: IOSServerConfig
private static let sharedContextID: ServerID = ServerID(
uuidString: "00000000-0000-0000-0000-0000000000A1"
)!
var body: some View {
let ctx = config.toServerContext(id: Self.sharedContextID)
List {
Section {
memoryRow(.memory, context: ctx)
.scarfGoCompactListRow()
memoryRow(.user, context: ctx)
.scarfGoCompactListRow()
memoryRow(.soul, context: ctx)
.scarfGoCompactListRow()
} footer: {
Text("MEMORY.md and USER.md live under `~/.hermes/memories/`. SOUL.md lives at `~/.hermes/SOUL.md`.")
.font(.caption)
}
}
.scarfGoListDensity()
.navigationTitle("Memory")
.navigationBarTitleDisplayMode(.inline)
}
@ViewBuilder
private func memoryRow(_ kind: IOSMemoryViewModel.Kind, context: ServerContext) -> some View {
NavigationLink {
MemoryEditorView(kind: kind, context: context)
} label: {
HStack(alignment: .top, spacing: 12) {
Image(systemName: kind.iconName)
.font(.title3)
.foregroundStyle(.tint)
.frame(width: 28, alignment: .center)
VStack(alignment: .leading, spacing: 2) {
Text(kind.displayName)
.font(.body)
.fontWeight(.medium)
Text(kind.subtitle)
.font(.caption)
.foregroundStyle(.secondary)
}
}
.padding(.vertical, 4)
}
}
}