
Introduce MV and MVVM patterns in iOS, build a JSON-consuming app to compare them, learn validation, and explore Core Data budgeting with fetch requests and transactions.
Access and download the exercise files and resources for this course, choose per-lecture code or the complete app to use the working code provided.
Prerequisites include understanding the UI framework and surf language, with proficiency in closures, functions, and optional arguments, using the X code and an open mind to the MV design pattern.
Understand the MVM design pattern, where the view model mediates between model and view to expose data and validate inputs on the client before reaching the model or service.
Compare MVVM implementations in WPF and SwiftUI, highlighting XAML bindings, and show how SwiftUI binds data within its view, blurring lines between view and view model.
Explore the limitations of the mvvm pattern in swiftui, including unavailable fetch requests and environment objects in the view model, and note gesture states and declarative ui parallels.
Build a simple MVVM iOS app that consumes the fake store API to display products using a web service, async/await, and decoding JSON into a product model.
Explore the MV pattern in iOS by building a store model as an aggregate root that fetches products via a web service, decodes JSON, and displays them on screen.
Validate a login form in an iOS MV pattern using SwiftUI by requiring non-empty email and password and a valid email format, enabling the login button only when valid.
Learn to display inline error messages under email and password and manage login form validation with a login form error struct, enabling clean, scalable form validation in SwiftUI.
Learn how to implement form validation in a SwiftUI app by using a login state as a view model, switch on error types, and display localized error messages.
Learn to display error messages as a validation summary under the login form, using an errors array of localized errors identifiable for reuse via a dedicated summary view.
Explore building a coffee ordering app using the MV design pattern, connect to a Node.js express server hosted on glitch, validate inputs, and perform add, update, delete, and fetch operations.
Explore the mv design pattern where the view requests data from an aggregate coffee model, which uses a web service and http client to fetch from a node.js express server.
Explore a Node.js and Express JS server hosted on Glitch that powers an iOS coffee ordering app, exposing endpoints to create, update, delete, and fetch orders for end-to-end testing.
Implement a web service in a SwiftUI iOS app to fetch orders using async/await. Define an order model and wire a hardcoded URL in a basic URL session for display.
Define the coffee model as the aggregate root, an observable object that fetches orders via a web service and updates published orders on the main queue.
Display coffee orders in a SwiftUI list by injecting a coffee model and web service into the environment, render hardcoded orders, and apply currency formatting and test identifiers.
Configure the iOS app’s testing environment by defining dev and test enums, base URLs, environment variables, and endpoints, then wire a configurable web service for end-to-end tests.
Create an end-to-end UI test to verify no orders are displayed when the order list is empty, using a UI testing bundle and accessibility identifiers.
Create a function to place an order via a web service, post json-encoded order data, and decode the server response, then build a basic interface with validation for coffee orders.
Implement the add new order view in a swiftui app, capturing name, coffee, price, and size with a segmented control and a place order button.
Learn how to add UI validation to a SwiftUI add coffee form with per-field errors. Explore when a view model helps for large forms and implement numeric and empty checks.
Validate the add new order user interface and implement an async place order using a coffee model, environment object, and web service to place and append the new order.
Learn to write an end-to-end test for placing an order in a SwiftUI app. Launch the app, tap add new order, fill name, coffee, and price, then place the order.
Implement the delete order flow by calling the server's delete endpoint with the order ID, returning the deleted order, and updating the UI and model to remove it.
Create an end-to-end test that builds an order in the UI, deletes it via the collection view, and uses teardown to clear remaining orders.
Update order webservice with put, JSON payload, and decoding the updated order; reuse the same add screen for updating orders and update the coffee model by the order's index.
Navigate from the order list to a detail view by order ID, display the selected order, and enable update or delete actions via a sheet and the detail view.
Implement an update order UI in a SwiftUI iOS app by reusing the add coffee view for editing, prepopulating fields, updating titles and actions, and preparing end-to-end tests.
Learn to write an end-to-end UI test for updating an existing order in an iOS app, covering setup, navigating to edit, text fields, accessibility identifiers, and teardown.
Explore building a budget app that writes to a local database via Core Data, manages categories, adds transactions, tracks remaining funds, and detects overspent amounts.
Create a Core Data model for a budget app by defining a budget category entity with non optional title, total, and date created, and extend it with a category extension.
Set up a core data manager singleton to initialize the core data stack with a persistent container, handle errors, and expose the view context through the environment for SwiftUI.
Learn to add a new budget category in SwiftUI by building a form with title and total, using a view context, currency formatting, validation, and saving to Core Data.
Launch the ad budget category view in a sheet from a navigation stack using a toolbar button, then fetch and display budget categories with Core Data.
Refactor the app by introducing a budget list view to display budget categories with totals, handle empty states, and compute a grand total via reduce.
Enable swipe-to-delete for budget categories in iOS SwiftUI using an on delete closure in the budget list. The content view handles deletion with view context and save to finalize removal.
Investigate fixing core data previews by injecting the managed object context, enabling delete and save for budget categories, and refactoring, then learn adding transactions to budgets.
Create a transaction entity with title, total, date. Define a one-to-many relationship from budget category to transactions and add a category extension for computed properties in the budget detail view.
Create a Core Data transaction class and set its date on insert, then wire the budget list to a budget detail view to view and add transactions.
Build a SwiftUI form to add a transaction with title and total, enable the save button only when valid, and persist the transaction to a budget category via Core Data.
Define a static function on budget category to fetch transactions by category via a date-sorted fetch request and predicate, then display them with titles and currency totals in SwiftUI.
Learn to compute remaining and overspending for a budget category by managing a private transactions array, deriving total and remaining, and displaying a responsive SwiftUI budget summary.
Learn to delete a transaction in a SwiftUI MV design pattern app by wiring an on delete closure from transaction list to the parent view, with persistence and budget updates.
Enable sheet-based add and edit actions from the budget list view by long-pressing a category to open the edit flow and pass the budget category for updates.
Update a budget category in MV design iOS app by passing the category to an edit view, populating fields, and saving via a save or update flow with core data.
Refactor and complete app by fixing the user interface, displaying total budget, tightening layouts, and resetting fields after saves, with encapsulated fetch requests, core data usage, and no view models.
Master the MV pattern in iOS with SwiftUI through next steps. Start small projects to reduce view model boilerplate and explore Apple's food truck and fruit apps via the resources.
MVVM is the default pattern when building SwiftUI applications. I have been personally using the MVVM pattern since the inception of SwiftUI in 2019.
After building hundreds of demos and prototypes, I started to notice issues with using MVVM patterns for SwiftUI applications. These issues resulted in adding needless complexity and constantly fighting the SwiftUI framework.
In this course, I will explain a different pattern for building SwiftUI apps. This pattern is used by Apple to build their SwiftUI applications. The pattern is called the MV pattern, where M stands for Model and V is for View.
Let’s check out the contents of the course:
Understanding MV Pattern
In this section you will learn the thinking behind the MV pattern and how it is different from the MVVM pattern. We will compare SwiftUI with WPF and conclude that in SwiftUI, the View is also the View Model.
Validation
In this section, you will learn how to perform validation using MV pattern. These validation techniques are inspired from the React framework. You will learn how to perform simple validation, inline validation and even validation summary.
Coffee Order - [Project Time]
In this section, you will be building a complete Coffee Ordering application integrated with a JSON API. You will learn how to create an aggregate root model and webservice layer, which allows the app to consume and present data. You will also learn how to write end-to-end tests for your application.
Budget App - [Project Time]
In this section, you will learn how to build a SwiftUI app using MV pattern, which uses Core Data to persist information on the device. You will learn to use property wrappers including @FetchRequest and @Environment, which makes working with Core Data a breeze.
Who is this course for?
Developers who wants to learn Apple’s way of building SwiftUI applications
Developers who wants to stop fighting the SwiftUI framework and start building iOS apps
Developers who wants to start using all the power and flexibility provided by the SwiftUI framework
Developers who wants to write less code to achieve more
This course will serve as an eye opener to many developers and will provide a lot of information on a different and easier way for building SwiftUI applications.
After this course, you will be ready to start building your apps using the MV pattern.
Let’s get started.