Tiny Brain Games is a SwiftUI collection of quick, single-session mini-games that focus on reflexes, memory, and attention. Each game is designed to be finished in under a minute and tracks best scores per difficulty.
TinyBrainGames.xcodeproj)TinyBrainGames.xcodeproj in Xcode.TinyBrainGames scheme.Cmd-U in Xcode.TinyBrainGames/Views: SwiftUI screens for each game and shared UI componentsTinyBrainGames/ViewModels: game logic and timersTinyBrainGames/Models: game state, scoring, and difficultyTinyBrainGames/Utilities: utilities like hapticsThis project uses a theme layer (TinyBrainGames/UITheme) so you can swap artwork without touching gameplay code.
TinyBrainGames/Assets.xcassets in Xcode.UIAssetRole raw values)ui/screen_backgroundui/home_card_backgroundui/home_card_icon_backgroundui/tile_hiddenui/tile_revealedui/tile_highlight_goodui/tile_highlight_good_strongui/tile_highlight_badui/button_primary_backgroundui/button_secondary_backgroundDefaultArtProvider) uses the current SwiftUI materials and colors.ArtProvider in TinyBrainGames/UITheme.@StateObject private var themeStore = ThemeStore(
theme: Theme(
tokens: .default,
primaryArt: AssetCatalogArtProvider(),
fallbackArt: DefaultArtProvider()
)
)
Use a global provider for shared art, then layer a per-game provider for a specific view.
Global provider at app launch:
@StateObject private var themeStore = ThemeStore(
theme: Theme(
tokens: .default,
primaryArt: AssetCatalogArtProvider(),
fallbackArt: DefaultArtProvider()
)
)
Per-game override provider (example for Minesweeper):
struct MinesweeperArtProvider: ArtProvider {
func image(for role: UIAssetRole) -> Image? {
switch role {
case .tileHidden:
return AssetCatalog.imageIfExists(named: "ui/games/minesweeper/tile_hidden")
case .tileRevealed:
return AssetCatalog.imageIfExists(named: "ui/games/minesweeper/tile_revealed")
case .tileHighlightGood:
return AssetCatalog.imageIfExists(named: "ui/games/minesweeper/tile_highlight_good")
case .tileHighlightBad:
return AssetCatalog.imageIfExists(named: "ui/games/minesweeper/tile_highlight_bad")
default:
return nil
}
}
}
Apply the override only to that game:
MinesweeperView(highScoreStore: highScoreStore)
.environmentObject(
ThemeStore(theme: themeStore.theme.applying(overrideArt: MinesweeperArtProvider()))
)
Notes:
ArtProvider that only returns assets for that game’s roles.GameView()
.environmentObject(
ThemeStore(theme: themeStore.theme.applying(overrideArt: MyGameArtProvider()))
)
AssetCatalogArtProvider in your theme (example above).