- Type: macOS application
- Stack: Swift 6.2, SwiftUI, HighlightSwift
- Architecture: MVVM with @Observable
- Platform: macOS 15.0+ only
This CLAUDE.md is the authoritative source for development guidelines.
Extends global configuration from ~/.claude/CLAUDE.md.
- MUST use Swift 6.2 strict concurrency mode
- MUST use
@Observablefor view model state (notObservableObject) - MUST use
@MainActorfor all UI-related code - MUST ensure all shared types conform to
Sendable - MUST run SwiftFormat before committing:
swiftformat . - MUST target macOS 15.0+ (Sequoia) minimum
- MUST NOT commit secrets, API keys, or credentials
- MUST NOT use hardcoded colors (see Color Usage below)
NEVER use hardcoded colors like .gray, .red, .green, etc.
ALWAYS use semantic colors from BifcodePackage/Sources/BifcodeFeature/Extensions/Color+Semantic.swift:
// WRONG
Text("Do's").foregroundColor(.green)
Rectangle().fill(.red)
// CORRECT
Text("Do's").foregroundColor(.indicatorDo)
Rectangle().fill(.indicatorDont)Semantic Colors to Define:
Color.indicatorDo- Green checkmark/Do indicatorColor.indicatorDont- Red X/Don't indicatorColor.editorBackground- Code editor backgroundColor.editorLineNumber- Line number textColor.editorText- Default code textColor.windowBackground- Window backgroundColor.titleText- Window title text
Rationale: Ensures consistent theming and future light/dark mode support.
- SHOULD use
@AppStoragefor user preferences persistence - SHOULD prefer computed properties over stored state when possible
- SHOULD use DocC documentation (
///) for public APIs - SHOULD keep views lightweight, delegate logic to ViewModels
- MUST NOT use AppKit unless absolutely necessary for export
- MUST NOT suppress Swift warnings without documented justification
- MUST NOT use
anykeyword without explicit justification - MUST NOT hardcode file paths (use FileManager APIs)
# Build (workspace)
xcodebuild -workspace Bifcode.xcworkspace -scheme Bifcode -configuration Debug build
# Run
open -a Bifcode
# Format code
swiftformat .
# Run tests
xcodebuild test -workspace Bifcode.xcworkspace -scheme Bifcode -destination 'platform=macOS'
# Build SPM package only
cd BifcodePackage && swift buildswiftformat . && xcodebuild test -workspace Bifcode.xcworkspace -scheme Bifcode -destination 'platform=macOS'Bifcode/
├── Bifcode.xcworkspace/ # Open this in Xcode
├── Bifcode.xcodeproj/ # App shell project
├── Bifcode/ # App target (minimal)
│ ├── Assets.xcassets/ # App icons, colors
│ ├── BifcodeApp.swift # @main entry point
│ └── Bifcode.entitlements # Sandbox settings
├── BifcodePackage/ # Primary development area
│ ├── Package.swift # SPM configuration
│ ├── Sources/BifcodeFeature/ # Feature code
│ └── Tests/ # Unit tests
├── BifcodeUITests/ # UI automation tests
└── Config/ # XCConfig build settings
BifcodePackage/Sources/BifcodeFeature/
├── ContentView.swift # Main app view
├── Models/
│ ├── SettingsTypes.swift # Enums: IndicatorPosition, IndicatorStyle, WindowLayout
│ └── CodePanel.swift # Code panel model
├── Views/
│ ├── CodeEditorView.swift # Code editor with line numbers
│ ├── CodePanelView.swift # Complete panel with indicator
│ ├── IndicatorBadgeView.swift # Do/Don't badge
│ └── SettingsView.swift # Preferences panel
├── ViewModels/
│ └── AppViewModel.swift # Main view model
└── Extensions/
└── Color+Semantic.swift # Semantic colors
Bifcode/Assets.xcassets/
├── AccentColor.colorset/ # App accent color
└── AppIcon.appiconset/ # App icon
BifcodePackage/Tests/BifcodeFeatureTests/ # Unit tests
BifcodeUITests/ # UI tests
| Package | Version | Purpose |
|---|---|---|
| HighlightSwift | 1.1+ | Syntax highlighting & language auto-detection |
In Xcode:
- File → Add Package Dependencies
- URL:
https://github.com/appstefan/highlightswift - Version: 1.1+
- Line numbers (configurable visibility)
- Syntax highlighting via HighlightSwift
CodeText - Auto-detect language with manual override
- Monospace font (SF Mono or system monospace)
- Dark theme background
- Position: top-right (default) or bottom-left
- Styles: icon-only, text-only, icon+text
- Do: Green checkmark with "Do's" label
- Don't: Red X with "Don'ts" label
- Configurable size
- PNG format, high-resolution
- Side-by-side or stacked layout
- Auto-size to content
- Watermark: bottom-center, configurable text
- Save location: Desktop (default), user-configurable
Use @AppStorage for all user preferences:
@AppStorage("indicatorPosition") var indicatorPosition: IndicatorPosition = .topRight
@AppStorage("showTitle") var showTitle: Bool = true
@AppStorage("indicatorSize") var indicatorSize: Double = 48
@AppStorage("fontSize") var fontSize: Double = 14
@AppStorage("windowLayout") var windowLayout: WindowLayout = .horizontal
@AppStorage("saveLocation") var saveLocation: String = "~/Desktop"
@AppStorage("watermarkText") var watermarkText: String = "bifcode"# Find SwiftUI views
rg -n "struct.*View.*:" BifcodePackage/Sources
# Find ViewModels
rg -n "@Observable.*class" BifcodePackage/Sources
# Find models
rg -n "struct.*:" BifcodePackage/Sources/BifcodeFeature/Models
# Find color usage
rg -n "Color\." BifcodePackage/Sources# Find all @AppStorage usage
rg -n "@AppStorage" BifcodePackage/Sources
# Find HighlightSwift usage
rg -n "import HighlightSwift" BifcodePackage/Sources
rg -n "CodeText" BifcodePackage/Sources
# Find export logic
rg -n "ImageRenderer\|NSImage" BifcodePackage/Sources- Review bash commands before execution
- Confirm before:
git push --force,rm -rf, any destructive operation - No network requests (offline app)
- All data stays local
- No analytics or telemetry
- Export saves to user-specified location only
- Branch from
masterfor features:feature/description - Use Conventional Commits:
feat:,fix:,docs:,refactor: - PRs require: passing tests, SwiftFormat, type checks
- Squash commits on merge
- Delete branches after merge
- Unit tests: All ViewModels, Services
- Integration tests: Export pipeline
- Framework: Swift Testing preferred (
@Test,#expect) - Location:
/Tests/directory - Run tests before committing
Standard tools available:
rg(ripgrep) for code searchgitfor version controlswiftfor package managementxcodebuildfor building and testingswiftformatfor code formatting
- Allowed: Read any file, write Swift files, run tests/builds
- Warn first: Edit
Info.plist,Package.resolved - Ask first:
git push, delete commands - Block: Force push to master
- HighlightSwift Async: Use
await highlight.attributedText()for manual highlighting - ImageRenderer macOS: Requires
@MainActorcontext - Window Sizing: Use
GeometryReaderfor content-based sizing - Font Metrics: SF Mono has different metrics than system fonts
- Color Assets: Must define both light/dark variants
- Export Resolution: Use
scaleparameter for Retina export
Sample UI mockups in tasks/20251217-bifcode-setup/images/:
dos-window-sample.png- Green checkmark indicatordonts-window-sample.png- Red X indicator