DEV Community

Van Hung Nguyen
Van Hung Nguyen

Posted on

Recommended iOS Project Structure by Clean Architecture

The Recommended Project Structure

For a project with your level of complexity (Bible app, multiple translations, Core Data), a Modularized SPM approach is best. If you prefer a single target, use this folder hierarchy:

/App (The Composition Root)
├── DependencyInjection/ (Swinject or custom Container)
└── AppLauncher.swift (App Struct)

/Domain (The "Brain")
├── Entities/ (Translation.swift, Verse.swift)
├── UseCases/ (FetchVersesUseCase.swift, BookmarkVerseUseCase.swift)
└── Interfaces/ (TranslationRepositoryProtocol.swift)

/Data (The "Worker")
├── Repositories/ (TranslationRepository.swift)
├── DataSources/
│   ├── Remote/ (APIClient.swift, TranslationDTO.swift)
│   └── Local/ (CoreDataStack.swift, CDTranslation+Mapping.swift)
└── Mappers/ (DTOToEntityMapper.swift)

/Presentation (The "Face")
├── Scenes/ (The UI screens)
│   ├── TranslationList/
│   │   ├── TranslationListView.swift
│   │   └── TranslationListViewModel.swift
│   └── TranslationDetail/ ...
├── Components/ (Reusable SwiftUI Views)
└── Coordinator/ (Navigation logic)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)