iOS

MVVM Architecture

MVVM pattern, ViewModel, data binding, separation of concerns, testability

20 면접 질문·
Mid-Level
1

What is a ViewModel in MVVM architecture?

답변

The ViewModel encapsulates business logic and manages view state independently from UIKit or SwiftUI. It bridges the Model and View layers while maintaining clear separation of concerns. This architecture enables unit testing and improves code maintainability and reusability.

2

What are the main responsibilities of the Model in MVVM?

답변

The Model represents the data and business logic of the application. It defines data structures, enforces business rules, and remains independent from View and ViewModel layers. Model independence from UI frameworks ensures reusability and testability. It serves as the single source of truth for application data.

3

What is the main role of the View in MVVM architecture?

답변

The View is responsible for displaying data and capturing user interactions. It should contain only presentation code and avoid business logic. The View binds to the ViewModel through data binding to remain simple and testable. In SwiftUI, use @ObservedObject or @StateObject to observe the ViewModel. In UIKit, use Combine to subscribe to changes.

4

What is data binding in the context of MVVM?

5

What is the difference between @Published and @ObservedObject in SwiftUI?

+17 면접 질문

다음 면접을 위해 iOS을 마스터하세요

모든 질문, flashcards, 기술 테스트, 코드 리뷰 연습, 면접 시뮬레이터에 접근하세요.

무료로 시작하기