🌟 We are Open Source! Check out our repository on GitHub

Swift Project Structure

A scalable and maintainable folder structure for Swift applications

File Structure

  • MyApp
    • AppDelegate.swift
    • SceneDelegate.swift
    • Modules
      • Home
        • HomeViewController.swift
        • HomeViewModel.swift
        • HomeView.swift
      • Profile
        • ProfileViewController.swift
        • ProfileViewModel.swift
        • ProfileView.swift
    • Core
      • Models
      • Services
      • Networking
      • Extensions
    • UI
      • Components
      • Styles
    • Resources
      • Assets.xcassets
      • Fonts
      • Localizable.strings
      • Info.plist
  • MyAppTests
    • UnitTests
    • UITests
  • MyApp.xcodeproj
  • MyApp.xcworkspace
  • Podfile
  • Package.swift
  • README.md

Directory Structure Explanation

Modules/

Feature-based organization following MVVM or VIPER architecture patterns.

Modules/Home/

Complete home feature module with view controller, view model, and view.

Core/

Core functionality and infrastructure shared across the entire application.

Core/Services/

Service classes handling business logic, API calls, and data management.

Core/Networking/

Network layer implementation including API clients and request handling.

Core/Extensions/

Swift extensions adding functionality to existing classes and types.

UI/

User interface components and styling organized for reusability.

UI/Components/

Reusable UI components and custom views used throughout the app.

MyAppTests/

Test target containing unit tests and UI tests for the application.

Package.swift

Swift Package Manager manifest file for managing dependencies.