Skip to content

Instantly share code, notes, and snippets.

@codewithsanthoshofficial
Last active June 12, 2026 05:13
Show Gist options
  • Select an option

  • Save codewithsanthoshofficial/76d2b3372785767cf60762b7f75b706b to your computer and use it in GitHub Desktop.

Select an option

Save codewithsanthoshofficial/76d2b3372785767cf60762b7f75b706b to your computer and use it in GitHub Desktop.
MVVM
###Clean Architecture
Flow: View → ViewModel → UseCase → Repository (protocol) → RepositoryImpl → API → DTO
Features
└── News
├── Presentation
│ ├── Views
│ │ ├── NewsView.swift
│ │ └── NewsListView.swift
│ │
│ └── ViewModels
│ └── NewsViewModel.swift
├── Domain
│ ├── Entities
│ │ └── News.swift
│ │
│ ├── UseCases
│ │ └── FetchNewsUseCase.swift
│ │
│ └── Repositories
│ └── NewsRepository.swift
├── Data
│ ├── Models (DTO)
│ │ └── NewsDTO.swift
│ │
│ ├── Repositories
│ │ └── NewsRepositoryImpl.swift
│ │
│ └── Services
│ └── NewsAPIService.swift
MVVM + XCTest (Unit Tests) – Standard iOS Folder Structure
Project
├── App
│ ├── Application
│ │ ├── AppDelegate.swift
│ │ └── SceneDelegate.swift
│ │
│ ├── Core
│ │ ├── Networking
│ │ │ └── APIClient.swift
│ │ │
│ │ ├── Extensions
│ │ └── Utilities
│ │
│ ├── Features
│ │ └── Login
│ │ ├── Views
│ │ │ └── LoginViewController.swift
│ │ │
│ │ ├── ViewModels
│ │ │ └── LoginViewModel.swift
│ │ │
│ │ ├── Models
│ │ │ └── LoginModel.swift
│ │ │
│ │ └── Services
│ │ ├── LoginService.swift
│ │ └── LoginServiceProtocol.swift
│ │
│ └── Resources
│ ├── Assets.xcassets
│ └── LaunchScreen.storyboard
├── AppTests (Unit Tests – using XCTest)
│ └── Features
│ └── Login
│ └── LoginViewModelTests.swift
└── AppUITests (UI Tests)
└── LoginUITests.swift
============================================================
Features
├── Home
│ ├── Views
│ ├── ViewModels
│ ├── Models
│ └── Services
├── News
│ ├── Views
│ ├── ViewModels
│ ├── Models
│ └── Services
└── Filters
├── Views
└── ViewModels
OR
Features
└── Home
├── HomeList
├── News
└── Filters
============================================================
Production-Level iOS Folder Structure
App
├── AppDelegate
├── SceneDelegate
├── AppCoordinator
Core
├── Networking
│ ├── APIClient
│ ├── Endpoints
│ └── NetworkError
├── Storage
│ ├── UserDefaultsManager
│ └── KeychainManager
├── Utilities
│ ├── Extensions
│ ├── Helpers
│ └── Constants
└── Base
├── BaseViewController
└── BaseViewModel
Features
├── Login
│ ├── Views
│ ├── ViewModels
│ ├── Models
│ └── Services
├── Home
│ ├── Views
│ │ ├── HomeViewController
│ │ ├── HomeCell
│ │
│ ├── ViewModels
│ │ ├── HomeViewModel
│ │
│ ├── Models
│ │ ├── HomeModel
│ │
│ └── Services
│ ├── HomeService
│ ├── News
│ │ ├── Views
│ │ ├── ViewModels
│ │ ├── Models
│ │ └── Services
│ └── Filters
│ ├── Views
│ └── ViewModels
├── Incidents
│ ├── Views
│ ├── ViewModels
│ ├── Models
│ └── Services
└── Settings
├── Views
├── ViewModels
└── Models
Resources
├── Assets.xcassets
├── Localizable.strings
└── Fonts
SupportingFiles
├── Info.plist
└── LaunchScreen
MVVM + XCTest (Unit Tests) – Standard iOS Folder Structure
Features
├── Home
│ ├── Presentation
│ │ ├── Views
│ │ │ └── HomeViewController
│ │ ├── ViewModels
│ │ │ └── HomeViewModel
│ │
│ ├── Domain
│ │ ├── Models
│ │ │ └── HomeModel
│ │ ├── UseCases
│ │ └── FetchHomeListUseCase
│ │
│ ├── Data
│ ├── Services
│ │ └── HomeService
│ ├── Repositories
│ └── HomeRepository
├── News
│ ├── Presentation
│ ├── Domain
│ └── Data
└── Filters
├── Presentation
└── Domain
Large Application MVVM Folder Structure (SwiftUI)
ProjectName
├── App
│ ├── ProjectNameApp.swift
│ └── AppRouter.swift
├── Core
│ ├── Networking
│ │ ├── APIClient.swift
│ │ ├── Endpoints.swift
│ │ └── NetworkError.swift
│ │
│ ├── Services
│ │ ├── AuthService.swift
│ │ ├── UserService.swift
│ │ └── StorageService.swift
│ │
│ ├── Managers
│ │ ├── SessionManager.swift
│ │ └── AppStateManager.swift
│ │
│ ├── Utilities
│ │ ├── Constants.swift
│ │ ├── Extensions
│ │ └── Helpers
│ │
│ └── DependencyInjection
│ └── DIContainer.swift
├── Features
│ │
│ ├── Authentication
│ │ ├── Models
│ │ │ └── User.swift
│ │ │
│ │ ├── ViewModels
│ │ │ ├── LoginViewModel.swift
│ │ │ └── SignupViewModel.swift
│ │ │
│ │ ├── Views
│ │ │ ├── LoginView.swift
│ │ │ ├── SignupView.swift
│ │ │ └── ForgotPasswordView.swift
│ │ │
│ │ └── Services
│ │ └── AuthAPI.swift
│ │
│ ├── Home
│ │ ├── Models
│ │ ├── ViewModels
│ │ └── Views
│ │
│ ├── Profile
│ │ ├── Models
│ │ ├── ViewModels
│ │ └── Views
│ │
│ └── Settings
│ ├── Models
│ ├── ViewModels
│ └── Views
├── Shared
│ ├── Components
│ │ ├── CustomButton.swift
│ │ ├── LoadingView.swift
│ │ └── ErrorView.swift
│ │
│ ├── ViewModifiers
│ └── Theme
│ ├── Colors.swift
│ └── Fonts.swift
├── Resources
│ ├── Assets.xcassets
│ ├── Localization
│ └── Fonts
├── AppTests
│ ├── ViewModelTests
│ │ └── LoginViewModelTests.swift
│ │
│ └── ServiceTests
│ └── APIClientTests.swift
└── AppUITests
└── LoginFlowTests.swift
===================
AppTests
├── ViewModelTests
│ └── LoginViewModelTests.swift
└── Mocks
└── MockLoginService.swift
==============================================
Architecture Flow (Large Apps)
View
ViewModel
Service / Repository
Networking Layer
API / Database
==============================================
Features
└── Orders
├── Models
│ └── Order.swift
├── ViewModels
│ └── OrdersViewModel.swift
├── Views
│ ├── OrdersListView.swift
│ └── OrderDetailView.swift
└── Services
└── OrdersAPI.swift
==============================================
@codewithsanthoshofficial02

Copy link
Copy Markdown

Swift - MVVM + DI

App

├── App
│ ├── DependencyContainer
│ └── AppCoordinator

├── Core
│ ├── Network
│ ├── Extensions
│ └── Utilities

├── Features
│ ├── Login
│ │ ├── Views
│ │ ├── ViewModels
│ │ ├── Services
│ │ └── Models
│ │
│ └── Home
│ ├── Views
│ ├── ViewModels
│ ├── Services
│ └── Models

├── SharedModels

└── Tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment