Game2048

SwiftUI • Swipe Gestures • Score Tracking • UserDefaults

About

Built a playable 2048 clone in SwiftUI with board compression and merge logic, swipe controls, and score persistence. The game tracks current and best score, adds random tiles after valid moves, checks for game-over states, and uses a clean reactive UI to keep the board and overlays synchronized with game state.

What it includes
  • 4x4 board model with move handling for left, right, up, and down
  • Tile compression and merge logic with real-time score updates
  • Swipe gesture controls tied directly to movement directions
  • Best-score persistence using UserDefaults
  • Game-over overlay and restart flow for replayability
Tech Stack
Swift SwiftUI ObservableObject UserDefaults Gesture Handling Game Logic