Skip to content

Conversation

@webcpu
Copy link
Owner

@webcpu webcpu commented Dec 30, 2025

⏺ Hybrid Xcode Project + Swift Packages Architecture

Restructure codebase to use standalone Swift packages managed by an Xcode project.

Changes

Architecture

  • Extract ClaudeUsageCore, ClaudeUsageData, ClaudeUsageUI as standalone packages in Packages/
  • Add Xcode project for app target with local package dependencies
  • Remove root Package.swift wrapper (packages are independent)

Structure

  • Flatten Sources/ and Tests/ directories (remove nested target folders)
  • Single Previews.swift as entry point for all SwiftUI previews

Fixes

  • Add LSUIElement=YES to hide dock icon and main window on launch
  • Add preview detection to prevent MenuBarExtra from blocking preview renders

Testing

make test # Runs all package tests

- Move ClaudeUsageCore, ClaudeUsageData, ClaudeUsageUI to Packages/
- Add standalone Package.swift for each package
- Add Xcode project with local sources for sandboxed app
- Disable sandbox to allow access to ~/.claude directory
- Fix Swift 6 concurrency: make SystemClock nonisolated
- Add missing ClaudeUsageCore import in AnalyticsRows
- Use realHomeDirectory() to access actual user home in sandbox
…p launch

- Detect preview environment via XCODE_RUNNING_FOR_PLAYGROUNDS
- Use minimal placeholder content in MenuBarExtra during previews
- Add ClaudeUsageUI dependency to Xcode project
- Remove duplicated source files now imported from package
- Remove ClaudeCodeUsage executable target from package
- Keep ClaudeUsageUI as pure library
- Xcode project provides the single app entry point
- Move files from Sources/ClaudeUsageUI/ to Sources/
- Add explicit path parameter to target definition
- Reduce nesting depth for cleaner navigation
- Add explicit path parameters to all targets
- Move Sources/<PackageName>/* to Sources/
- Move Tests/<PackageName>Tests/* to Tests/
- Reduce nesting depth for cleaner navigation
- Delete redundant root Package.swift and wrapper targets
- Update Makefile to run tests from individual packages
- Xcode project references packages directly in Packages/
- Add LSUIElement=YES to make app an accessory/agent app
- Window only appears when explicitly requested from menu bar
- Create Previews.swift as single entry point for all previews
- Contains Menu Bar and Main Window previews in one file
@webcpu webcpu merged commit ece0bc6 into main Dec 30, 2025
@webcpu webcpu deleted the feat/hybrid branch December 30, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants