Overview
A well-structured Tuist project improves maintainability, reduces build times, and makes collaboration easier. This guide covers best practices for organizing your projects, targets, and dependencies.Understanding Tuist Directory Structure
Standard Project Layout
A typical Tuist project follows this structure:Key Directories Explained
Tuist Directory
TheTuist/ directory serves two critical purposes:
- Signals the project root: Allows running Tuist commands from any subdirectory
- Contains shared configuration:
ProjectDescriptionHelpers/: Reusable Swift code for manifest filesPackage.swift: External dependency definitions
Root Directory Files
Tuist.swift: Project-wide configurationTuist.swift
Workspace.swift
Project.swift
Xcode workspaces in Tuist are optional. Tuist auto-generates a workspace containing your project and its dependencies. Only use
Workspace.swift if you need custom workspace configuration.Organization Strategies
Single Project Structure
Best for small to medium apps with straightforward requirements:- Single application target
- Limited feature complexity
- Small team (1-5 developers)
Multi-Project Structure
Best for larger applications with distinct feature modules:- Multiple feature teams
- Need for clear module boundaries
- Desire for parallel development
- Teams of 5+ developers
Micro-Framework Architecture
Best for large-scale apps with strict separation of concerns:- Very large applications
- Multiple teams working independently
- Need for module reusability
- Desire for selective compilation and testing
Target Organization Best Practices
Target Types
Organize targets by their purpose:Source File Organization
Using Buildable Folders (Recommended)
Tuist 4.62.0+ supports buildable folders (Xcode 16+), which automatically sync with the file system:Project.swift
- No regeneration needed when adding/removing files
- AI-friendly (coding assistants can modify files freely)
- Eliminates merge conflicts in project files
- Simpler configuration
Using Wildcard Patterns (Traditional)
For older Xcode versions or more control:Project.swift
Dependency Organization
Layered Architecture
Organize dependencies in layers:Example Layered Structure
Project.swift
Build Settings Organization
Using XCConfig Files
Extract build settings to xcconfig files for better maintainability:Project.swift
Using ProjectDescriptionHelpers
Create reusable code to reduce duplication across manifests:Tuist/ProjectDescriptionHelpers/Project+Templates.swift
Projects/FeatureA/Project.swift
Best Practices
Avoid Complex Build Configurations
Stick to standardDebug and Release configurations:
Instead:
- Use environment variables at runtime for different environments
- Use compiler directives to conditionally compile code
- Keep configurations simple and consistent
App Configuration
Validate Your Graph
Regularly check your dependency graph:Keep Projects Focused
Each project should have a single, clear responsibility:- App: Composition and app-specific code
- Features: User-facing functionality
- Core: Shared utilities and infrastructure
- Platform: Third-party integrations
Troubleshooting
Project Generation Failures
Iftuist generate fails:
- Check for circular dependencies:
tuist graph - Validate manifest syntax
- Ensure all referenced files exist
- Check that target names are unique
Slow Build Times
If builds are slow:- Break large targets into smaller modules
- Use static linking in release builds
- Enable binary caching (see Build Optimization)
- Review dependency graph depth
Merge Conflicts
If you still experience merge conflicts:- Use buildable folders instead of explicit file lists
- Keep manifest files simple and focused
- Use ProjectDescriptionHelpers for shared logic
- Have each team work in separate feature directories
Next Steps
Manage Dependencies
Learn how to handle external and internal dependencies
Optimize Builds
Speed up compilation with caching and optimization techniques
Set Up CI/CD
Configure continuous integration for your structured project
Migrate from Xcode
Migrate an existing project to this structure