Skip to content

Repository files navigation

Swift Playgrounds Game Tutorial Project

Swift 6 iOS 16+ SwiftUI + SpriteKit MIT License

English | 简体中文

Learn Swift by building a real game, develop creative confidence through making, and prepare for the WWDC Swift Student Challenge.

This repository is an open-source teaching project built with Swift Playgrounds, SwiftUI, and SpriteKit. It is designed for absolute beginners who want a practical path into Swift, interactive app development, and project-based learning.

The project is also the codebase behind a tutorial series covering beginner-friendly game development, AI-assisted coding, debugging, version control, and iterative feature building. It is open-sourced to lower the barrier for students, share a repeatable learning path, and help more people turn ideas into working software.

Gameplay demo

Why This Project

  • Teach fundamental Swift concepts through a concrete, playable project
  • Give beginners a realistic starting point for Swift Playgrounds
  • Provide inspiration and technical direction for WWDC Swift Student Challenge
  • Show how AI tools can support feature development, debugging, and iteration
  • Encourage students to express ideas through code and build original work

The author is a two-time Swift Student Challenge winner and created this repository to share a more accessible starting point with the community.

What You Will Learn

  • Basic Swift programming through real gameplay features
  • How SwiftUI and SpriteKit can work together in one app
  • How to structure a small game project with managers, scenes, and entities
  • How to iterate on features instead of trying to design everything upfront
  • How to use GitHub and AI tools as part of a beginner-friendly workflow

Features

Implemented

  • Main menu and game start flow
  • Virtual joystick movement
  • Tap-to-shoot interaction
  • Enemy tracking, damage, destruction, and scoring
  • Collision detection and damage resolution
  • High score persistence
  • Dynamic difficulty scaling
  • Power-up drops and effect management

In Progress

  • Wave system
  • Boss warning, boss spawning, and boss health UI
  • Tutorial and onboarding system
  • Pause menu and return-to-menu flow

Tech Stack

  • Swift 6
  • SwiftUI
  • SpriteKit
  • Swift Package Manager
  • AppleProductTypes

Minimum platform:

  • iOS 16.0+

Getting Started

Option 1: Swift Playgrounds

  1. Open Swift Playgrounds
  2. Import or open game.swiftpm
  3. Run the project

Option 2: Xcode

  1. Open the project directory with Xcode 16 or later
  2. Select an iPhone or iPad simulator
  3. Run the app

Controls

  • Virtual joystick on the lower-left: move the ship
  • Tap the screen: fire toward the tapped position
  • Collect power-ups: gain healing, shield, or fire-rate boosts
  • Survive longer and defeat more enemies: increase score and difficulty

Repository Structure

.
├── game.swiftpm/              # Main Swift Playgrounds project
│   ├── MyApp.swift
│   ├── ContentView.swift
│   ├── GameView.swift
│   ├── GameScene.swift
│   ├── GameManager.swift
│   ├── Player.swift
│   ├── Enemy.swift
│   ├── Projectile.swift
│   ├── CollisionDetector.swift
│   ├── DifficultyManager.swift
│   ├── PowerUp*.swift
│   ├── Boss*.swift
│   └── Tutorial*.swift
├── docs/assets/               # README assets
├── web-infographic/           # Supporting web infographic resources
├── README.md
├── README.zh-CN.md
└── LICENSE

Who This Is For

  • Students with zero or limited Swift experience
  • Learners exploring Swift Playgrounds through project-based practice
  • Students preparing for the WWDC Swift Student Challenge
  • Developers practicing SwiftUI + SpriteKit
  • Educators and creators demonstrating AI-assisted coding workflows

Companion Videos

These videos all use the same Swift Playgrounds project as their teaching base:

  1. Build a game from scratch with Swift
  2. AI coding and GitHub workflow
  3. Four essential Claude Code features
  4. Fix build errors with AI
  5. Use AI to speed up mini-game feature development

Recommended order:

  1. Start with the core gameplay and project setup
  2. Move on to AI-assisted feature expansion
  3. Finish with debugging and GitHub workflow practice

Project Philosophy

This repository is not meant to be a production-ready commercial game template. It is a teaching-first project built around a simple principle:

  • start small
  • make something playable early
  • learn by shipping features
  • improve through iteration

The broader goal is to help beginners see programming as a creative medium for building original work, not just as a set of abstract syntax rules.

Roadmap

  • Sound effects and background music
  • More enemy types
  • More complete boss mechanics and phases
  • Wave summary and stage selection
  • Local save data and achievements
  • More structured tutorial docs and visual assets

License

This project is licensed under the MIT License. See LICENSE for details.

About

A beginner-friendly Swift Playgrounds tutorial project for learning Swift, building interactive apps, and preparing for the WWDC Swift Student Challenge.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages