Documentation Home
Welcome to the complete technical documentation for TheCompanyApp — a comprehensive iOS business management platform built with SwiftUI, Core Data, and CloudKit.
What is TheCompanyApp?
TheCompanyApp is a full-featured business operations platform designed for iOS and iPadOS. It enables companies to manage inventory, process orders, coordinate dispatch operations, maintain contacts, track warehouse logistics, and collaborate in real-time with team members across multiple Apple devices.
The app is built on a sophisticated multi-tenant architecture with CloudKit-backed company sharing, enabling secure real-time collaboration while maintaining strict data isolation between different companies.
Who This Documentation Is For
This documentation serves three primary audiences:
Product Teams & Stakeholders
Learn about the product vision, features, and roadmap to understand what TheCompanyApp delivers to users.
End Users
Complete guides for using the app, from creating your first company to advanced workflows like multi-user dispatch coordination.
Developers & Architects
Technical reference for the Core Data model, CloudKit synchronization architecture, company-scoped persistence strategies, and remote change handling.
Documentation Structure
The documentation is organized into logical sections:
📘 Product Documentation
Overview: Product vision and value proposition
Core Concepts: Multi-tenancy, company scoping, and sync model
Feature Map: Complete catalog of functionality
Roadmap: Upcoming features and improvements
🚀 Getting Started
Installation: System requirements and setup
Create First Company: Complete onboarding flow
Login Flow: Authentication and company selection
Company Switching: Managing multiple companies
Sharing Companies: Inviting team members
📖 User Guide
Dashboard: Overview and quick actions
Inventory: Stock management and tracking
Orders: Sales order processing
Dispatch: Logistics and delivery coordination
Tasks: Assignment and tracking
Contacts: Customer and supplier management
Access Control: User permissions and roles
Notifications: Alert configuration
🏗️ Architecture
System Overview: High-level architecture
Core Data Model: Entity relationships and attributes
Company Scoping: Multi-tenant isolation strategy
Fetch Strategies: Efficient data retrieval
Remote Change Handling: CloudKit notification processing
☁️ CloudKit
Sync Architecture: Private and shared database model
Private Store: User-specific data synchronization
Shared Store: Cross-user company data sharing
Sharing Flow: CKShare creation and participation
Ownership Rules: Owner vs participant permissions
Conflict Resolution: Merge policies and strategies
Sync States: Understanding CloudKit sync lifecycle
Troubleshooting: Common issues and debugging
🔐 Security
Security Model: Data isolation and protection
Credential Storage: UserPass private database strategy
Data Isolation: Company-scoped queries and persistence
Permissions and Roles: AccessControl relationship model
🧪 Testing
TestFlight Flow: Distributing and testing
Share Testing Checklist: Validating multi-user scenarios
Debugging Logs: Reading CloudKit logs
Common Issues: Known problems and solutions
Quick Navigation
Understand what the app does
Create my first company
Invite team members
Understand the data model
Learn how CloudKit sharing works
Debug sync issues
Understand security design
Key Architectural Concepts
Before diving into the documentation, understand these core concepts:
Company-Scoped Multi-Tenancy
Every data entity (except UserPass and AccessControl) is scoped to a specific company via companyID. This enables a single user to participate in multiple companies while maintaining complete data isolation.
Dual Persistent Store Architecture
The app uses two Core Data persistent stores:
Private Store (
TheCompanyApp.sqlite): Syncs to iCloud Private Database (user's own data)Shared Store (
TheCompanyApp-shared.sqlite): Syncs to iCloud Shared Database (invited company data)
CloudKit Sharing Model
When a company owner shares their company:
The
Companiesrecord becomes the root of aCKShareAll related records are enlisted into the share's zone
Participants access the company via the Shared Store
Owners continue to access via Private Store
Credential Isolation
UserPass entities (username/password) are stored only in the Private Store and never shared. Each participant maintains their own credentials locally, isolated from other users.
Contributing to Documentation
This documentation reflects the actual implementation as of February 2026. When making changes to the app, update the corresponding documentation sections to maintain accuracy.
Support & Feedback
For technical questions or clarifications about the implementation, review:
The inline code comments in Swift files
CloudKit logs using
OSLogfilteringXcode's Core Data debugging tools
Last Updated: February 2026
App Version: Compatible with iOS 16.0+
CloudKit Container: iCloud.TheCompany.3N
Last updated