Organizing iOS Files Based on the Clean Architecture

Separation of Concerns

Steven Curtis
4 min readDec 18, 2024
Photo by Sara Kurfeß on Unsplash

In any iOS application, knowing what should go where is an essential way of organizing code and making sure our code is maintainable for the future.

How you should organize the key components and files within an iOS application then?

Here is a roadmap of how I think you could organize files within your application, and maintain a separation of concerns that can improve maintainability within any given iOS application. Based on the clean architecture here is the organization system you might use if creating an all-new greenfield application.

View

Purpose

Handles UI rendering and displaying content. In SwiftUI, it would be a struct conforming to View. In UIKit, it could be UIView subclasses.

Responsibilities

Display data passed from the ViewModel or ViewController.

Handle user interactions (e.g., button taps) and forward those to the ViewModel or ViewController.

Should not contain business logic.

Example Files

MovieListView.swift (SwiftUI)

--

--

No responses yet