

Architecture choices directly affect testability, maintainability, and UI complexity in an iOS codebase such as the American Express Global Business Travel mobile app.
Explain MVC and MVVM in the context of iOS development. Your answer should cover:
Keep the discussion focused on practical iOS engineering. The interviewer expects you to compare the two patterns clearly, mention common pitfalls such as “Massive View Controller,” and explain how your choice changes for simple screens versus state-heavy, data-driven screens.
In iOS MVC, the Model holds data and business rules, the View renders UI, and the Controller coordinates user input and updates between the View and Model. In UIKit, UIViewController often becomes the Controller, which can lead to too much logic accumulating in one place.
class TripsViewController: UIViewController {
var trips: [Trip] = []
override func viewDidLoad() {
super.viewDidLoad()
// fetch data, transform it, and update views
}
}
In MVVM, the View remains focused on rendering and user interaction, while the ViewModel prepares presentation data and exposes UI-ready state. The Model still represents domain data, but the ViewModel becomes the main mediator between domain logic and the UI.
class TripListViewModel {
var titleText: String { "Upcoming Trips" }
func rowTitle(at index: Int) -> String {
return trips[index].cityName
}
}
MVC commonly uses direct callbacks and imperative updates from the controller to the view. MVVM often uses binding through closures, Combine, RxSwift, or SwiftUI state, which makes state changes more explicit and easier to observe.
viewModel.onTripsUpdated = { [weak self] in
self?.tableView.reloadData()
}
MVC can be harder to test when business and presentation logic live inside UIViewController. MVVM improves unit testing by moving formatting, validation, and UI state transitions into ViewModel classes that can be tested without rendering UI.
func testHeaderTitle() {
let vm = TripListViewModel(trips: sampleTrips)
XCTAssertEqual(vm.titleText, "Upcoming Trips")
}
MVC is often sufficient for small, straightforward screens with limited state and simple interactions. MVVM is usually a better fit when screens have asynchronous loading, multiple UI states, formatting logic, or reusable presentation behavior across views.