
Build a tic tac toe game in SwiftUI using clean, layered architecture with UI, business logic, data access, and networking; enable human, AI, and online play with Firebase.
Create a SwiftUI home view for a tic tac toe game by initializing an iOS project in Xcode and building a reusable title area with game-mode buttons.
Create and display game modes in a SwiftUI iOS app by modeling a case iterable, identifiable enum, using app strings for localization, and color-driven UI styling.
Explore reusable SwiftUI button styles by building a configurable up button style with a color parameter, framing, capsule clipping, opacity effects, and a pattern style extension for easy use.
Explore presenting the game view as a full-screen modal in SwiftUI, and pass the selected game mode to the game view, updating it on button presses.
Build a SwiftUI game view by adding a top-right close button using VStacks, HStacks, and spacers, then style a rounded white button with padding, frame, and colors.
Enable dismiss behavior for the score and notification views using the SwiftUI environment dismiss, and build a score view with player names, scores, padding, and a dynamic game status.
Build a 3x3 game board of nine circles with a view model controlling the game view, using a lazy grid of three flexible columns and a geometry reader.
Extract and reuse a SwiftUI board circle view to render a 3x3 grid, sizing with a geometry reader, layering X or O marks with a zStack on user taps.
Create a reusable SwiftUI port indicator view that displays a system image by name (SF symbols) with a spring scale animation on name changes placed atop game circles.
Refactor the game view by initializing its view model with a game mode. Inject the view model via an observed object and have the view render the mode from the model.
Learn to build a two-player SwiftUI game with MVVM: a game view model manages player names, scores, active player, and modes (human, computer, online) with codable players for Firebase.
Implement and manage tic-tac-toe moves in a two-player SwiftUI MVVM game, handling circle taps, occupancy checks, and turn switching with X and O marks stored as game moves in Firebase.
Trigger the process move function on tap, update the moves array, and render circle indicators from moves; switch active players, prevent moves on occupied spots, and prepare a game-over check.
Implement a tic-tac-toe win and draw system in Swift, checking for a win before a draw, counting non-nil moves, and validating patterns against win conditions.
Update the game notification and score logic using a ViewModel: display active player moves, show dynamic player names and scores, and increment the winning player's score on each win.
Reset the game by setting the active player to player one and clearing all moves, while observing the players array with Combine to assign player names and support rematch.
Build an alert item in a SwiftUI MVVM online game by defining the alert item, game states, and triggering alerts with title, message, and a rematch button.
Learn to present alerts in a SwiftUI game view using an alert item tied to a view model, including title, message, dismiss actions, and rematch to reset the game.
Implement a smarter AI for the cpu opponent in versus computer mode by computing optimal moves, blocking the human, and prioritizing the center, with a brief thinking delay.
Block the game port during the AI turn, compute the CPU position, process moves, and re-enable input for the next turn using the view model and the disabled modifier.
Create a firebase-backed game object that models online play, with two players, scores, moves, active player, and a winner or draw state, using a Codeable and Identifiable Swift struct Game.
Sign into Firebase with a Google account, create an iOS project, enable Firestore, and set anonymous read/write access; download and add Google service info plist to the Xcode project.
Add the Firebase SDK to your iOS SwiftUI project using Swift Package Manager, select Firebase Firestore and Firebase Firestore Swift, and initialize Firebase with GoogleService-Info.plist to enable cloud data communication.
Create a reusable Firebase repository with helper functions, a collection reference enum, and generic, codable operations for get, listen, delete, and save; supports unit tests and mocking.
Explore finishing touches to the Firebase repository, including delete by collection and id, save with Codable encoding, filtered get documents, and real-time updates via Combine.
Create an online game repository that sits between the Firebase repository and the game view model to keep the view model backend-agnostic, handle joining, blocking moves, and syncing scores.
Implement dependency injection with the factory pattern to swap real and mock firebase repositories, enabling unit testing for the online game repository's create, join, and listen workflows.
Subscribe to the Firebase listen function using Combine and sink to receive game updates, update the local game, and store subscriptions in a cancelable set while handling errors.
Implement online game functionality in the game view model by observing the Firebase-backed online game repository, subscribing to changes, and starting online play with join game logic and user notifications.
Create and join an online Firebase game by auto-creating a new game when none exists, track active player, moves, and scores, and enforce main-thread UI updates with main actor.
Subscribe to online game changes by observing the game state with combine, initialize moves and scores, manage loading state as players join, and synchronize online game updates with local state.
Test and synchronize an online game by monitoring firebase updates, handling player two joins, updating scores, and enabling or disabling the game port based on active player status.
Set the active player in an online SwiftUI game by comparing local and game IDs, update notifications to show whose move, with alerts for draw or win.
Learn to synchronize the online game state with Firebase, show quit alerts, disable the board, and update the online game flow with a game process enum.
Test an online two-player SwiftUI game with Firebase across iOS 14 simulators, verify real-time moves, rematch, and reset, and implement quit handling and a loading indicator.
Refactor the game view model to inject the online repository, set up the unit test target, and configure Firebase Firestore Swift linking so tests can access the app code.
Create dedicated test files for each class, establish a system under test, and verify the game view model reset and nine nil moves.
Learn unit testing for a SwiftUI game, including reset and game notification checks, testing process moves through public entry points, and validating game finish and occupied square handling.
Develop and validate game logic in a Swift-based iOS app by writing and running async tests that verify player wins, draws, CPU moves, and score updates.
Mock the Firebase repository with a protocol and dependency injection, returning a dummy game or nil via a combine publisher to simulate data changes and keep tests independent.
Learn to replace the real Firebase repository with a mock in tests by configuring a mock factory and container, enabling join game tests and ready game outcomes using Combine.
Explore testing an online game repository by writing asynchronous tests that subscribe to game publishers, join and create games, validate mock and player IDs, and prepare for App Store submission.
Prepare your iOS game for App Store submission by configuring a unique bundle ID, providing screenshots for multiple devices, and detailing app information, pricing, and privacy in App Store Connect.
Publish your iOS game by preparing the info.plist encryption flag, testing on iPad, and archiving with Xcode, then upload via App Store Connect, manage builds, and submit for review.
Explore an iOS16 SwiftUI MVVM game architecture where the view, view model, and online backend connect via a network protocol with fetch, listen, save, and delete, enabling backend swaps.
In the Tic Tac Toe Game course, we will build a real game and publish it on AppStore.
The topics covered in the course will help you to learn advanced iOS development. All the components are reusable and can be used in this project and your other apps.
What you will learn:
MVVM
Make a beautiful user interface with SWIFTUI
Button Styles
Firebase Firestore (new real-time database from Firebase)
Dependency injection
Unit testing including async UnitTests
Async Code
Networking
Clean architecture
and many more
This Tic Tac Toe Game course is NOT a beginner-level course. You need to know your way around the xCode, be familiar with it, and have to have basic knowledge of Swift, SwiftUI, and application building. We are going to start from scratch and build the application together. I will provide all assets. I will type and explain every line of code. By the time we finish, you will learn a lot of new things even if you are an experienced iOS developer.
The curse will teach you how to write clean and readable code and structure your app development, so even if you get back to your code in a few years, you can read and understand it clearly.
Don’t waste your time on low-quality courses where you don't even get the support of the instructor
Your time is precious. We offer the best video courses with carefully crafted content, we are learning by coding!
Don't just take our word for it, check out our other courses and what other students have to say about our courses!