A modern macOS application template built with SwiftUI, SwiftData, and Swift 6 concurrency.
- π¨ SwiftUI with NavigationSplitView for native macOS experience
- πΎ SwiftData for modern, type-safe persistence
- β‘ Swift 6 concurrency with
@MainActordefault isolation - π App Sandbox + Hardened Runtime enabled
- π§ͺ Swift Testing framework + XCUITest for comprehensive testing
- π SwiftLint (Build Tool Plugin) + SwiftFormat for code quality
- π Localization ready with String Catalogs
- β¨οΈ Keyboard shortcuts and menu commands
- βοΈ Settings window with
@AppStorage
- macOS 15.6+
- Xcode 26+
- Swift 6
-
Clone this repository
git clone https://github.com/yourusername/WindowCleaner.git cd WindowCleaner -
Open the project
open WindowCleaner.xcodeproj
-
Build and run Press
βRin Xcode
WindowCleaner/
βββ App/
β βββ WindowCleanerApp.swift # App entry point, scene configuration
βββ Models/
β βββ Item.swift # SwiftData models
βββ Views/
β βββ ContentView.swift # Main NavigationSplitView
β βββ Components/
β β βββ ItemRow.swift # Reusable view components
β βββ Settings/
β βββ SettingsView.swift # Preferences window (β,)
βββ Utilities/
β βββ AppError.swift # App-specific error types
β βββ Constants.swift # Config & Metrics
β βββ Logger.swift # os.Logger wrapper
βββ Resources/
βββ Assets.xcassets # App icons, colors, images
βββ Localizable.xcstrings # Localized strings
This template follows a lightweight MVVM pattern optimized for SwiftUI + SwiftData:
- Views: SwiftUI views using
@Query,@State,@Environment - ViewModels (optional):
@Observableclasses for complex business logic - Models: SwiftData
@Modelclasses - Services: Networking, file operations, external integrations
See .cursor/rules/architecture.mdc for detailed guidelines.
# Format all Swift files
swiftformat .
# Check formatting without modifying
swiftformat --lint .SwiftLint runs automatically on every build. To run manually:
swiftlint
swiftlint --fix # Auto-fix correctable issues# Run all tests
make test
# Or using xcodebuild
xcodebuild test -project WindowCleaner.xcodeproj -scheme WindowCleaner -destination "platform=macOS"make buildGenerate and view API documentation using DocC:
# Generate documentation
make docs
# Generate and open in Xcode
make docs-open
# Generate and preview in browser (http://localhost:8080)
make docs-preview
# Clean documentation artifacts
make docs-cleanAll public types, methods, and properties are documented with DocC-style comments. See .cursor/rules/docc-documentation.mdc for the complete documentation guide.
| Shortcut | Action | Menu |
|---|---|---|
β, |
Open Settings | App Menu |
βH |
Hide Application | App Menu |
βQ |
Quit Application | App Menu |
| Shortcut | Action |
|---|---|
βN |
New Item |
βW |
Close Window |
| Shortcut | Action |
|---|---|
β« (Delete) |
Delete Selected Item |
βZ |
Undo |
β§βZ |
Redo |
βX |
Cut |
βC |
Copy |
βV |
Paste |
βA |
Select All |
| Shortcut | Action |
|---|---|
βM |
Minimize |
ββF |
Toggle Full Screen |
| Shortcut | Action |
|---|---|
| β | Show Welcome |
| β | WindowCleaner Documentation |
| β | Report an Issue |
Note: Standard macOS shortcuts (
βZ,βC,βV, etc.) are provided automatically by the system.
The app uses App Sandbox with the following capabilities:
- User-selected file read/write access
Modify WindowCleaner.entitlements to add capabilities like:
- Network access
- Camera/microphone
- Location services
User preferences are stored using @AppStorage and automatically sync via UserDefaults.
Use the included renaming script to quickly rebrand the template for your new app:
# Basic usage (keeps original organization identifier)
./Scripts/rename-project.sh "MyNewApp"
# With custom organization identifier
./Scripts/rename-project.sh "TaskMaster" "com.mycompany"The script will:
- β
Rename all directories (
WindowCleaner/βMyNewApp/) - β
Rename all files (
WindowCleanerApp.swiftβMyNewAppApp.swift) - β
Update bundle identifiers (
com.fernandobelotto.WindowCleanerβcom.mycompany.MyNewApp) - β Update all code references
- β Clean Xcode DerivedData and caches
After running the script:
- Open the renamed
.xcodeprojin Xcode - Clean build folder (
ββ§K) - Build and run to verify everything works
- Create a new file in
Models/ - Define your
@Modelclass - Add to the schema in
WindowCleanerApp.swift - See .cursor/rules/swiftdata-models.mdc for patterns
- Create a new file in
Views/orViews/Components/ - Follow the structure in .cursor/rules/swiftui-views.mdc
- Include
#Previewfor Xcode canvas
Detailed documentation is available in the .cursor/rules/ directory:
- Architecture Guidelines
- SwiftUI Views
- SwiftData Models
- Testing
- DocC Documentation - Writing and generating API docs
- Code Snippets
- SwiftLint
- SwiftFormat
Browse the generated DocC documentation:
make docs-preview # Opens at http://localhost:8080- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Run
swiftformat .before committing - Ensure all tests pass
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Apple's SwiftUI and SwiftData frameworks
- SwiftLint for code quality
- SwiftFormat for formatting