Skip to content

p-larson/TCA-Snake-2

Repository files navigation

TCA-Snake-2

xcodebuild

This repository contains the source code for the macOS interpretition of the popular game Snake, built with SwiftUI and TCA.


About

Snake is a retro arcade-style game, built in almost every programming language in existance, it's history is similar to that of Pong. The whole application is powered by the Composable Architecture with a focus on composability, modularity, and testing.

Architecture

Snake.swift

Dependencies

  • HighScoreClient
    Acts a database, with a getter and setter method to interact with the stored data which is just for this projects purpose: the
    highscore. This, like the other dependencies, doesn't make any real world requests. Simply, this mimicks the structure of a potential RESTful API get and post request but instead of it being to a server, its just to UserDefaults. So yes, this is just a controlled dependency wrapper for local storage, but this makes it testable and composable!

  • CoordinateGenerator
    Represents a third party system with a failable task to generate a Coordinate inside of a player's game. This does not actually send a request outside of the system, it's a just to simulate a outside system request.

Tests

TCA_Snake_2_Tests.swift