Tic Tac Toe App Icon
SwiftUI Game

Tic Tac Toe
The One

Build a complete SwiftUI game with clean MVVM architecture, dependency injection, and an AI bot engine. Learn real-world game state management, animated win detection, and modular service patterns.

Get Source Code Complete Xcode project
Tic Tac Toe Gameplay

100% SwiftUI

Native framework

MVVM + DI

Clean architecture

AI Bot Engine

3 difficulty levels

Light & Dark

Full theme support

Features

Everything inside the project

A complete game with polished UI, smart AI, and clean architecture patterns you can learn from and reuse.

🎮 Game Setup

Choose your game mode

Configure every match before it starts. Play against a friend or challenge the AI bot with three difficulty levels. Customize player names and symbols for a personal touch.

  • Player vs Player and Player vs AI game modes
  • AI difficulty selection: Easy, Medium, and Hard
  • Player name and symbol customization
Game Setup Screen
AI Difficulty Selection
Gameplay in Progress
Winner Screen
Gameplay

Smooth, animated gameplay

A polished 3x3 grid with fluid animations on every move. Track turns in real time, persist scores across rounds, and enjoy a responsive, native-feeling game experience.

  • 3x3 grid with animated move placement
  • Real-time turn tracking and player indicators
  • Score persistence across multiple rounds
🏆 Win Detection

Animated winning paths

When a player wins, the winning path lights up with a smooth animation. A game over sheet reveals the results, and round tracking keeps the competition going.

  • Animated winning path reveal on victory
  • Game over sheet with results and replay option
  • Round tracking across game sessions
Winner Animation
Winner Dark Mode
AI Bot Setup
AI Gameplay
🤖 AI Bot Engine

Smart, modular AI logic

The AI bot service is fully modular and separated from the game logic. Three difficulty levels drive different decision-making strategies, from random moves to optimal play.

  • Difficulty-based AI decision logic (Easy, Medium, Hard)
  • Modular bot service decoupled from game state
  • Separated game validation and win detection services
🌙 Dark Mode

Full dark and light support

Every screen adapts seamlessly between light and dark themes. The source code demonstrates proper color asset management and adaptive UI patterns for both appearances.

  • Complete light and dark mode support across all views
  • Adaptive color assets and system theme integration
  • Clean SwiftUI patterns for theme-aware UI components
Setup Dark Mode
Winner Dark Mode

Architecture

Clean code, real patterns

This project demonstrates production-level game architecture in SwiftUI. Every layer is separated, testable, and easy to understand.

MVVM + Factory DI

ViewModels manage game state and business logic. A Factory pattern provides dependency injection for clean, testable code.

Modular Game Services

Game validation, win detection, and bot logic are each their own service — easy to test, swap, or extend independently.

Game State Management

Separated game state from UI state. Clean data flow between board model, player turns, scores, and game outcomes.

Bot Decision Engine

The AI bot is a standalone service with difficulty-specific strategies — from random picks to blocking and optimal play.

Clean SwiftUI Views

Declarative UI with proper view composition, reusable components, and smooth spring animations throughout the app.

Win Detection Service

A dedicated service checks all win conditions (rows, columns, diagonals) and returns the winning path for animation.

What's Included

Everything you need

A complete, ready-to-build Xcode project with every file, service, and pattern documented in code.

📦

Full Xcode Project

Complete, ready-to-build project. Open in Xcode, run on Simulator or device. No setup required.

🏗️

MVVM + Factory DI

Professional MVVM architecture with Factory-based dependency injection for clean, testable code structure.

🤖

AI Bot with Difficulty

Three difficulty levels with distinct strategies. A modular bot service you can study and extend.

Animated Win Paths

Winning combinations animate with smooth transitions. Learn how to build polished game animations in SwiftUI.

📊

Score Tracking

Persistent score tracking across rounds. See how game state is managed cleanly with separated concerns.

🌗

Light & Dark Mode

Full theme support with adaptive colors and proper asset management. Every screen looks polished in both modes.

Get Started

Ready to build games
with clean code?

Get the complete Xcode project with MVVM architecture, AI bot engine, and polished SwiftUI game patterns. Learn by studying real, shipping-quality code.

Get Source Code