
Set up a new Xcode project, install three packages via Swift Package Manager (combine cocoa, snap kit, swift snapshot testing), and add images to assets for unit tests.
Set up the root view controller programmatically by removing the storyboard and info.plist entry, then configure the scene delegate to create a window and display the yellow root view.
Create high-level components—logo view, result view, view input view, tip input view, and split input view—then arrange them with a vertical stack view and SnapKit auto layout.
Define reusable theme constants for colors and fonts using a hex color extension and Colors.co palettes. Apply these styles to the UI background and typography.
Learn to build a logo view by combining an image view with a top and bottom label using attributed string, arranged in horizontal and vertical stack views with auto layout.
Create a reusable result view with header and amount per person labels using attributed text in a vertical stack, add a shadowed separator, and compose with horizontal and spacer views.
Build a reusable blue input view with a header, a currency denomination label and a numeric text view, wired with a decimal keypad and a done toolbar using SnapKit.
Build the header view with two labels (top bold, bottom regular) arranged in a vertical stack, add top and bottom spacers, and expose a configure method to set their texts.
Design a tip input view with a header and a horizontal stack of 10%, 15%, and 20% tip buttons, plus a custom tip option, using a builder.
Add split input view details, building a header, decrement and increment buttons, and a quantity label in a horizontal stack. Implement rounded corners with a corner mask and SnapKit constraints.
Clean up the views by correcting the 10%, 15%, and 20% buttons and updating the split input view to display a plus button, then verify in the simulator.
Add a view model to connect the view controller and business logic, define inputs and outputs, and use publishers to compute amount per person, total view, and total tip.
Observe the bill input view using Combine Cocoa, publish text changes from the text view, convert to a double, and feed to the view model via a value publisher.
Observe publishing tip selections with combine from a tip input view. Compare current value subject and pass through subject, mapping taps to 10%, 15%, 20% for the view model.
Handle the custom tip button by presenting an alert with a number pad input for a user-entered tip. Use a combine publisher to pass the value to the tip model.
Manage the custom tip button selection by resetting all tip options, observing the tip subject, and updating the button color and text for 10%, 15%, 20%, or custom tips.
Observe the split input view and update the quantity with plus and minus buttons, enforcing a minimum of one, and publish changes using Combine publishers.
Compute the result in the view model by observing multiple publishers with combine latest, then calculate total tip, total bill, and per person amount as inputs change.
learn how to dynamically display calculation results in a result view by feeding a result object from the view model, formatting currency per person and total with a configure function.
Extend the double with a currency formatted string and use a number formatter to display whole or decimal values; apply it in the amount view for tips and per-person totals.
Dismiss the keyboard by tapping outside the text view with a combine cocoa tap publisher and connect the view and logo tap publishers to the view model.
Send the logo view tap publisher to the view model, define input and output, and trigger a reset form action in the view controller.
Add a tap-triggered sound effect by injecting a dedicated audio player service into the logo view's view model, using an AV audio player to play a bundled click file.
Implement calculator reset by wiring reset across the build input, tip input, and split input views, update the total to zero, and animate the logo view reset.
Set up a unit test for calculator VM with Combine, verifying that a 100 bill with no tip or split yields total amount per person 100, and total tip 0.
Add more tests to cover all permutations of the billing logic, including tip, split, and custom tip scenarios, and validate results with assertions throughout varied inputs.
Test the logo view double-tap to verify that the reset calculator publisher fires and the sound plays, using a mock audio player service and given–when–then test structure.
Clean up test code by removing the unused audio player service and refactoring the logo view, then initialize test elements in setup and run the tests in Xcode.
Learn to implement image snapshot tests to protect view layouts and icons by recording a master screenshot and comparing future user interface changes against it.
Add snapshot tests with custom values for the input and result views, configuring values and recording to verify UI behavior.
Learn to add UI tests by setting accessibility identifiers for the total amount per person, total view value, and total tip value labels, and verify they start at zero.
Add all accessibility identifiers across UI components to support UI tests, including view input, split input, tip input, logo views, text fields, increment and decrement buttons, and quantity labels.
Add all screen elements to the calculator UI, including logo, view input, tip buttons, and split controls, and define actions for entering values and selecting tip types.
Test regular tip flow with UI tests for 10%, 15%, and 20% tips, validating totals and per person splits when inputting $100 and adjusting split to four and two.
Test the custom tip flow with a UI test, entering bill and custom tip, and splitting the total, while verifying reset behavior via accessibility identifiers.
Celebrate your completion of the course and consider leaving a five-star rating with feedback. Explore the instructor's Udemy profile for more courses and promo offers to continue your developer journey.
Dear students, please use this source code to check against your code if you are stuck in lessons or encounter any errors. While you are coding alongside with me through the videos, I would recommend to follow the exact steps I take without any modification even if you feel you can make improvements. Any improvements should be made after the project is completed to fit your style or naming convention.
Welcome to the iOS & Swift - MVVM, Combine, SnapKit, Snapshot/UI/Unit Tests course!
In this course, I share my learnings as a professional iOS developer with 6 years experience on the topics that are relevant to the industry today. The materials I've prepared are knowledge that I wish I knew as a 3 year old developer struggling with concepts like:
Protocol orientated programming
Reactive programming
MVVM architecture (why not MVC?)
Coding views programatically with SnapKit (without Storyboards)
Writing unit tests
Writing Snapshot tests
Writing UI tests
In this course, I explain and implement the above-mentioned concepts through a simple Tip Calculator application step by step. I start off by building the UI, then the ViewModel which house the business logic and finally implement the various tests to ensure that we preserve the integrity of our code.
These concepts are extremely important to a senior iOS developer because of the expectations and responsibilities placed on you by the various stakeholders in your company. As such, you need the SKILLS to
Debug issues quickly
Upkeep code coverage and testability to ensure CI passes
Set an example to junior members in your team with high quality coding standards
Avoid on-call nightmares (paper duty ringing non-stop)
Fix and stop adding new tech debts
Maintain your sanity as your app grows over time
So this course targets developers who have been working for around 3 years who want to get to the next level. I am confident you will grow after completing this course.