This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Input Source Pro is a macOS utility for automatic input source switching. It's a Swift/Cocoa application using the MVVM architecture with Combine for reactive programming.
Open Input Source Pro.xcodeproj in Xcode:
Cmd+B- BuildCmd+R- RunCmd+U- Run tests
CLI:
xcodebuild -scheme "Input Source Pro" -configuration Debug build
xcodebuild -scheme "Input Source Pro" -configuration Debug test-
Models/: ViewModels containing business logic and state management
PreferencesVM: Manages app preferences and Core Data persistenceIndicatorVM: Controls input source indicator and switching logicApplicationVM: Tracks active applications and browser focusInputSourceVM: Handles input source managementPermissionsVM: Manages system permissionsNavigationVM: Manages app navigation state
-
Controllers/: Window and menu controllers
IndicatorWindowController: Controls the on-screen indicator windowPreferencesWindowController: Controls the preferences/settings windowStatusItemController: Manages the menu bar status item
-
UI/: SwiftUI views
-
Persistence/: Core Data models and storage
-
Utilities/: Helper classes and extensions
-
Window/: Window management classes
-
System/: App initialization and system-level code
- AXSwift (custom fork): Accessibility API integration for tracking focused elements/windows
- SnapKit: Auto Layout DSL
- RxSwift/RxCocoa: Reactive programming
- Combine: Apple's reactive framework (heavily used in ViewModels)
- Sparkle: Auto-updates
- KeyboardShortcuts: Shortcut management
- Alamofire: Networking
All ViewModels are marked with @MainActor - they must run on the main thread.
- Core Data: Main data store (
Main.xcdatamodeld) - UserDefaults: Simple preferences
- Custom caching for keyboard configurations
- Indentation: 4 spaces
- Naming:
- Types:
UpperCamelCase(e.g.,IndicatorWindowController) - Files follow type names
- Extensions use
Type+Feature.swiftpattern (e.g.,IndicatorWindowController+Activation.swift)
- Types:
- Commit messages: Conventional commits with scopes (e.g.,
feat(UI): add indicator toggle) - Follow Swift API Design Guidelines
- Application-based input source switching: Detects active app and switches input source
- Browser-based switching: Detects browser tabs for website-specific switching (supports Safari, Chrome, Arc, Edge, Vivaldi, Opera, Brave, Firefox, Zen, Dia)
- Input source indicator: On-screen display of current input source
- Function key mode switching: Per-app function key behavior
- Punctuation mode: Force English punctuation per app
- Custom shortcuts: Keyboard shortcuts and single-modifier shortcuts for input source switching
The app integrates with browser extensions to detect the current website. The browser extension communicates with the main app for website-based input source rules.
The app requires:
- Accessibility permissions: For tracking focused applications and windows
- Browser extension permissions: For detecting active website (optional)
Managed via Swift Package Manager in Xcode. No Package.swift file - dependencies are configured in the Xcode project.