Skip to content

Snake game written in Swift. Runs on any browser using WebAssembly and on macOS with SwiftUI.

License

Notifications You must be signed in to change notification settings

Jomy10/SnakeSwift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game

Snake game built using Swift, playable on any browser using WebAssembly and on macOS.

Browser

UI built using Tokamak, which is a SwiftUI compatible framework for WebAssembly. Interaction with the DOM is done through JavaScriptKit. Built and bundles using Carton.

Source code for the browser UI in WebApp.

macOS

Since Tokamak is a SwiftUI compatible framework, a Mac app can be easily created without too much adjustments.

Source code for the mac version in SnakeMacApp.

Core library

The core library contains all the game logic. This imports TokamakShim, which uses SwiftUI for compatible platforms, TokamakDOM for web and TokamakGTK for Linux. Using conditional compilation (#if), platform-specific functions are handled (e.g. using Foundation for macOS and JavaScriptKit for the web).

Contributing

If you find any bugs or have any improvement suggestions, please open an issue first. If you get green light, you can open a pull request.

If you want to work on any open issues, just comment on the issue with your intentions. If you end up not working not working on it anymore, please comment again.

License

Licensed under MIT license.