Documentation Index
Fetch the complete documentation index at: https://docs.swiftaiboilerplate.com/llms.txt
Use this file to discover all available pages before exploring further.
Full technical details in your project at
/docs/modules/Core.mdWhat’s new in v2.0
DeepLinkBusandToastCenterare now@Observable. Consumers that used.onReceive($center.currentToast)should migrate to.onChange(of: center.currentToast). SwiftUI’s new observation machinery does the rest.- Swift 6 strict concurrency across the package.
What You Get
- ✅ AppError enum - Maps all system errors to user-friendly messages
- ✅ AppLogger - OSLog-based with automatic PII redaction
- ✅ ResultOrError - Functional error handling patterns
- ✅ Theme types - UserThemePreference enum
- ✅ Zero dependencies - Pure foundation layer
Key Components
AppError (Production Type)
Here’s a shortened version of the production enum from the boilerplate:- ✅ Auto-maps URLError, NSError, custom errors
- ✅ Preserves technical details for logging
- ✅ Provides actionable user messages
- ✅ Sendable for Swift 6 compatibility
- ✅ Equatable for testing
AppLogger
Structured logging with PII redaction:.subsystem- Application subsystem.ui- User interface events.networking- HTTP requests.storage- Database operations.auth- Authentication flows.ai- LLM interactions.feature- Feature operations.notifications- Notification operations
Customization Examples
Add Custom Error Type
Add Custom Log Category
Key Files
| Component | Location |
|---|---|
| AppError | Packages/Core/Sources/Core/AppError.swift |
| AppLogger | Packages/Core/Sources/Core/AppLogger.swift |
| Diagnostics | Packages/Core/Sources/Core/Diagnostics/ |
Dependencies
- None - Core has zero dependencies (by design)
Used By
- ✅ All other modules (foundation layer)
- ✅ ViewModels (error handling)
- ✅ Services (logging)
Best Practices
Error Handling
Error Handling
- Always map errors to
AppError - Use specific error reasons
- Provide actionable user messages
- Log technical details separately
Logging
Logging
- Never use
print()(banned by linter) - Choose appropriate log level
- Use correct category
- Redact PII automatically
Learn More
Full Documentation
Complete Core guide
Networking Module
Uses Core for errors and logging
Storage Module
Uses Core for error handling
Architecture
See how Core fits in
Test Coverage
96%+ - Highest coverage in the codebase Tests include:- Error mapping scenarios
- Logger output verification
- PII redaction
- Category filtering
