DEV Community

Sebastien Lato
Sebastien Lato

Posted on • Edited on

How I Structure All My Xcode Projects.

πŸ—‚οΈ 1. The Folder Structure

AppName/
β”‚
β”œβ”€β”€ App/
β”‚ β”œβ”€β”€ AppEntry.swift
β”‚ └── AppState.swift
β”‚
β”œβ”€β”€ Features/
β”‚ β”œβ”€β”€ Home/
β”‚ β”œβ”€β”€ Settings/
β”‚ β”œβ”€β”€ Profile/
β”‚ └── Shared/
β”‚
β”œβ”€β”€ Services/
β”‚ β”œβ”€β”€ Audio/
β”‚ β”œβ”€β”€ Network/
β”‚ β”œβ”€β”€ Storage/
β”‚ └── Notifications/
β”‚
β”œβ”€β”€ Models/
β”‚
β”œβ”€β”€ Utilities/
β”‚
β”œβ”€β”€ Design/
β”‚ β”œβ”€β”€ Colors.swift
β”‚ β”œβ”€β”€ Typography.swift
β”‚ └── Components/
β”‚
β”œβ”€β”€ Resources/
β”‚ β”œβ”€β”€ Assets.xcassets
β”‚ └── Sounds/
β”‚
└── Support/
β”œβ”€β”€ InfoPlist-Notes.md
└── DebugHelpers.swift


🎯 Why This Structure Works

βœ” Features folder = clean separation

Each feature contains:

  • View
  • ViewModel
  • Subcomponents
  • Logic specific to that feature

No giant files. No spaghetti.


βœ” Services are abstracted

Every service has:

  • a protocol
  • a live implementation
  • optionally a mock

Makes testing way easier:

protocol AudioServiceProtocol {
    func play(_ file: String)
    func stopAll()
}
Enter fullscreen mode Exit fullscreen mode

βœ” Design system lives in one place

Colors, typography, reusable components, spacing β€” all centralized.

Your app finally feels consistent.


βœ” Resources are not mixed with logic

Sounds, JSON files, images, fonts β€” all under one folder.


βœ” Support folder stores non-shipping dev files

Notes, documentation, experiments, debug helpers.


🧩 Workflow Tips

1. Use extension files sparingly

Don’t put every modifier and helper in one huge file.

Instead create:

Utilities/Date+Format.swift
Utilities/String+Validation.swift
Enter fullscreen mode Exit fullscreen mode

Much cleaner.


2. Use folders, not groups

Fewer path issues when collaborating or using build scripts.


3. Keep feature folders self-contained

A feature should be easy to move, rename, or delete.
If a feature can't stand alone β†’ it’s not modular enough.


πŸš€ Final Thoughts

This structure helps me:

  • scale apps faster
  • onboard contributors easily
  • debug without hunting files
  • avoid β€œjunk drawer” folders

Top comments (0)