Full technical details in your project at
/docs/modules/Core.mdWhat 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 the actual 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
Find complete technical guides inside your project under /docs/modules/Core.md.
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
