MVP Architecture Setup for iOS App

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
MVP Architecture Setup for iOS App
Medium
~2-3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

MVP Architecture Setup for iOS App

MVP on iOS went out of fashion with SwiftUI and MVVM+Combine arrival, but on UIKit projects with large codebase it remains justified. Especially where team came from Android (where MVP was standard until Jetpack) or where MVP structure historically settled, no reason to break it for trend.

How MVP differs from MVVM on UIKit

In MVVM ViewController subscribes to @Published properties of ViewModel via Combine. In MVP — Presenter doesn't know UIKit: works with View protocol, and ViewController implements protocol and updates UI itself. No bindings, no reactivity — but complete data flow control.

// View protocol — interface for Presenter
protocol ProfileView: AnyObject {
    func showUser(_ user: User)
    func showLoading(_ isLoading: Bool)
    func showError(_ message: String)
}

// Presenter — clean Swift, zero UIKit
final class ProfilePresenter {
    weak var view: ProfileView?
    private let userRepository: UserRepository

    init(userRepository: UserRepository) {
        self.userRepository = userRepository
    }

    func viewDidLoad() {
        view?.showLoading(true)
        Task {
            do {
                let user = try await userRepository.fetchCurrentUser()
                await MainActor.run {
                    view?.showLoading(false)
                    view?.showUser(user)
                }
            } catch {
                await MainActor.run {
                    view?.showLoading(false)
                    view?.showError(error.localizedDescription)
                }
            }
        }
    }
}

// ViewController — thin, UI only
final class ProfileViewController: UIViewController, ProfileView {
    private var presenter: ProfilePresenter!

    func showUser(_ user: User) {
        nameLabel.text = user.name
        avatarImageView.load(url: user.avatarURL)
    }

    func showLoading(_ isLoading: Bool) {
        isLoading ? activityIndicator.startAnimating() : activityIndicator.stopAnimating()
    }

    func showError(_ message: String) {
        // Toast or Alert
    }
}

Key point: weak var view: ProfileView? — weak reference mandatory, otherwise retain cycle. Presenter holds View, View holds Presenter — one must be weak.

Presenter testing

Main MVP advantage — Presenter tested without simulator:

func testViewDidLoad_success() async {
    let mockView = MockProfileView()
    let mockRepository = MockUserRepository(result: .success(User.fixture))
    let sut = ProfilePresenter(userRepository: mockRepository)
    sut.view = mockView

    sut.viewDidLoad()
    // Small pause for async Task
    try await Task.sleep(nanoseconds: 100_000_000)

    XCTAssertTrue(mockView.didShowUser)
    XCTAssertFalse(mockView.isLoading)
}

MockProfileView implements ProfileView with call flags. Test takes milliseconds, needs no XCUITest.

Navigation in MVP: Router / Wireframe

Presenter shouldn't manage navigation directly — violates Single Responsibility. Classical solution: Router (or Wireframe in original MVP terms):

protocol ProfileRouter: AnyObject {
    func navigateToEditProfile(user: User)
    func navigateToSettings()
}

Concrete ProfileRouterImpl works with UINavigationController — UIKit dependency isolated. Presenter gets Router via DI and calls router.navigateToEditProfile(user:) — without knowing what happens under hood.

When MVP better than MVVM

MVP convenient when team actively writes unit tests for screen logic and doesn't want add Combine as dependency. Also — with large UIKit screen count with UITableView / UICollectionView: Presenter conveniently handles delegate events, View just forwards calls.

On SwiftUI projects MVP feels unnatural — no UIViewController, pattern doesn't fit naturally.

What we set up

Design base View, Presenter, Router protocols → create module factory (each screen — ProfileModule.build() returns UIViewController) → set up DI → create example module with tests → optionally migrate existing MVC screens.

Work takes 2–3 days for new project.