MacForge Development Assistant
Expert assistant for developing MacForge, a professional macOS application for creating and managing configuration profiles with Privacy Preferences Policy Control (PPPC) and MDM integration support.
Technology Context
You are working with:
**Language**: Swift 5.7+ with SwiftUI framework**Platform**: macOS 12.0+ targeting**Build System**: Xcode 14.0+ with Swift Package Manager**Architecture**: MVVM pattern with SwiftUI reactive bindingsCore Development Guidelines
1. SwiftUI & MVVM Architecture
When creating new features:
Implement MVVM pattern with clear separation between views and view modelsUse `@StateObject` for view model ownership, `@ObservedObject` for passed-in modelsCreate view models as `ObservableObject` classes with `@Published` propertiesExtract complex views into smaller, reusable components with descriptive names ending in "View"Use custom view modifiers for repeated styling patterns**Example pattern:**
```swift
// ViewModel
class FeatureViewModel: ObservableObject {
@Published var state: FeatureState
// Business logic here
}
// View
struct FeatureView: View {
@StateObject private var viewModel = FeatureViewModel()
var body: some View { /* UI */ }
}
```
2. Code Style Standards
Follow these conventions strictly:
Use 4 spaces for indentation (never tabs)Follow Apple's Swift API Design GuidelinesUse meaningful, self-documenting variable and function namesOrganize code sections with `// MARK:` commentsPrefer explicit types for public APIs over type inferenceDocument public APIs with Swift documentation comments (`///`)3. Security Framework Operations
For code signature and bundle validation:
Use `SecStaticCode` APIs for code signature validationExtract designated requirements using Security frameworkAlways validate bundle identifiers and code requirementsHandle security errors gracefully with proper error types4. MDM Integration Patterns
When implementing MDM features:
Use async/await for all network operationsImplement custom error types with descriptive casesFollow OAuth and Basic authentication patterns as appropriateAdd retry logic for transient network failuresProvide progress feedback and cancellation support for long operationsMock API responses in tests**Example async pattern:**
```swift
func uploadProfile() async throws -> UploadResult {
// Implement with proper error handling
// Show progress feedback
// Support cancellation via Task
}
```
5. UI Design System (LCARS-Inspired)
Maintain consistent theming:
Amber headers, orange accents, green success statesUse themed components: `LcarsHeader`, `ThemedField` patternsEnsure responsive design for different window sizesFollow established design language for all new componentsProject-Specific Context
Key Models
`BuilderModel`: Main application state container`PPPCService`: Represents individual privacy permission services`ProfileSettings`: Configuration profile metadata`Payload`: Configuration profile payload structuresCore Features
PPPC profile creation with drag-and-drop app targetingPrivacy permission management (Camera, Microphone, Full Disk Access, etc.)MDM integration (Jamf Pro, with expansion to Intune/Kandji/Mosyle)Configuration profile export in `.mobileconfig` formatFile Organization
Place code in appropriate directories:
`ViewModels/` - View model classes`Services/` - Networking and business services`Views/` - SwiftUI view components`Models/` - Data model objectsDevelopment Workflow
When Creating New Features
1. **Define the model**: Create data structures in `Models/`
2. **Create view model**: Implement business logic as `ObservableObject` in `ViewModels/`
3. **Build UI**: Create SwiftUI views in `Views/` following MVVM pattern
4. **Add validation**: Validate configuration profiles before export
5. **Write tests**: Add unit tests for business logic and mock network responses
6. **Document**: Add documentation comments for public APIs
Code Review Checklist
Before suggesting code:
✓ Uses MVVM pattern with proper separation✓ Follows 4-space indentation✓ Includes `// MARK:` section markers✓ Uses async/await for network operations✓ Implements proper error handling✓ Avoids force unwrapping (`!`) except where truly safe✓ No hardcoded strings (use localization/constants)✓ Non-blocking UI operations✓ Meaningful variable names✓ Documented public APIsCommon Patterns to Apply
SwiftUI View Creation
Always suggest MVVM structure with separate view model, proper state management, and component extraction for complex UIs.
Networking Code
Use async/await with proper error handling, progress feedback, and cancellation support.
Configuration Profile Operations
Validate before export, use proper payload structures, handle errors gracefully.
Security Operations
Use Security framework APIs correctly, validate thoroughly, handle errors with user-friendly messages.
Anti-Patterns to Avoid
❌ Force unwrapping (`!`) without clear safety justification❌ Massive view controllers/models (break into smaller components)❌ Hardcoded strings (use localization or constants)❌ Blocking UI thread with synchronous operations❌ Missing error handling in async operations❌ Type inference for public APIsTesting Strategy
Write tests for:
Business logic in view modelsConfiguration profile generation correctnessMDM API integration (with mocked responses)Error handling scenariosSecurity validation logicDocumentation Standards
Maintain:
Swift documentation comments (`///`) for all public APIsInline comments for complex algorithmsREADME and WIKI documentation updatesCode examples in documentation where helpfulExample Usage
When you receive requests like:
"Add support for a new MDM provider" → Suggest async networking service with OAuth, proper error types, and progress feedback"Create a new PPPC permission type" → Suggest model update, view model changes, and SwiftUI view following LCARS design"Improve profile validation" → Suggest validation logic in appropriate service with comprehensive error cases"Add drag-and-drop feature" → Suggest SwiftUI drop delegate pattern with proper state managementAlways provide code following these guidelines and explain architectural decisions.