QUESTION IMAGE
Question
which architecture supports two - way data binding?
○ a. mvc
● b. mvvm
○ c. viper
○ d. singleton
clear my choice
which class handles api calls in swift?
● a. urlsession
○ b. jsondecoder
○ c. alamofire
○ d. both a and c
clear my choice
which data storage is simplest for small data?
○ a. core data
● b. userdefaults
○ c. realm
○ d. sqlite
clear my choice
Brief Explanations
- For the first question: MVVM (Model - View - ViewModel) architecture supports two - way data binding. In MVVM, the ViewModel acts as an intermediary between the View and the Model. When the View changes (e.g., user input in a text field), the ViewModel can update the Model, and when the Model changes (e.g., data retrieved from a server), the ViewModel can update the View. MVC (Model - View - Controller) has a more one - way data flow (Controller updates View based on Model changes, but View to Model updates are less straightforward in a pure MVC implementation). VIPER (View - Interactor - Presenter - Entity - Router) is more about separation of concerns for complex applications and doesn't inherently focus on two - way data binding. Singleton is a design pattern for creating a single instance of a class, not an architecture for data binding.
- For the second question: In Swift,
URLSessionis a native class for handling API calls. It can be used to create data tasks, upload tasks, and download tasks to interact with web services.Alamofireis a popular third - party library (which is built on top ofURLSessionin many cases) that also simplifies making API calls.JSONDecoderis used for decoding JSON data that is received from an API (e.g., after an API call has retrieved the data). So bothURLSession(native) andAlamofire(library) can handle API calls. - For the third question:
UserDefaultsis a simple key - value store in iOS (and macOS etc.). It is very easy to use for storing small amounts of data like user preferences (e.g., a boolean indicating if a user has seen a tutorial, a string for a username).Core Datais a more complex framework for object graph management and data persistence, suitable for larger and more complex data models.Realmis a mobile database with its own set of features for data storage and synchronization, which is more than what is needed for simple small data.SQLiteis a relational database, and while it can be used for small data, it requires more setup (e.g., writing SQL queries) compared to the simplicity ofUserDefaults.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
- B. MVVM
- D. Both A and C
- B. UserDefaults