Dice Foundry Student Workbook

Appendix C — Reference Directory

This appendix describes the folders and files that accompany the course, and how to use each one. For how to compare your work with a checkpoint or reset your project to one, see "How to Use This Workbook".

The course folders

Folder Contents
01-Student-Workbook This workbook.
02-Exercises-and-Challenges Each chapter's challenge with progressive hints, plus extra practice exercises.
03-Solutions-and-Answer-Key Knowledge Check answers, challenge solutions and extra exercise answers, plus the Final-Project-Solution folder.
04-Quick-Reference The Swift and SwiftUI Quick Reference Guide.
05-Reading-AI-Generated-Swift The guide to reading and troubleshooting AI-generated Swift code.
Reference-Checkpoints The app's source files at the end of each chapter from 1 to 13.
App-Icon The app icon images used in Chapter 11.

The documents (the first, second, third, fourth and fifth folders above) are provided as PDF, Word and Markdown files, where the Markdown file is the editable source.

Reference checkpoints are source files, not projects

Important: No Xcode project is included

The folders in Reference-Checkpoints, and the Final-Project-Solution folder, contain Swift source files. They do not contain a .xcodeproj file or an Xcode workspace. You cannot open a checkpoint folder directly in Xcode as a project. You compare a checkpoint with your own project, or copy its files into a project of your own. "How to Use This Workbook" gives the steps, and says which of them the course author did not test.

Each checkpoint has this shape:

Reference-Checkpoints/
  Checkpoint-NN-Name/
    DiceFoundry/         the app's source files (and, from Checkpoint 11, Assets.xcassets)
    DiceFoundryTests/    unit tests (Checkpoints 12 and 13 only)

The reference code was compiled with Xcode 27.2 at an iOS 17.0 minimum deployment target, with 0 errors and 0 warnings. The unit tests in Checkpoints 12 and 13 and in the final project solution were run on two simulators. Do not edit the files in Reference-Checkpoints. Copy from them or compare with them, and keep your own work in your own project.

Checkpoint contents

The table lists the Swift source files in each checkpoint. File names are relative to the checkpoint's DiceFoundry folder unless they start with DiceFoundryTests.

Checkpoint Chapter Source files
Checkpoint-01-Getting-Started 1 DiceFoundryApp.swift, ContentView.swift
Checkpoint-02-Swift-Fundamentals 2 the same two, plus SwiftPractice.swift
Checkpoint-03-Static-Interface 3 DiceFoundryApp.swift, ContentView.swift
Checkpoint-04-State-and-Random 4 DiceFoundryApp.swift, ContentView.swift
Checkpoint-05-Dice-Selection 5 the same two, plus DieType.swift
Checkpoint-06-Multiple-Dice 6 DiceFoundryApp.swift, ContentView.swift, DieType.swift
Checkpoint-07-Modifiers-and-Notation 7 DiceFoundryApp.swift, ContentView.swift, DieType.swift
Checkpoint-08-Roll-History 8 the same three, plus RollResult.swift
Checkpoint-09-Persistence 9 the same four, plus HistoryStore.swift
Checkpoint-10-Reusable-Components 10 Models/ (DieType.swift, RollResult.swift), Persistence/ (HistoryStore.swift), Views/ (DieButton.swift, DiePicker.swift, RollOptionsView.swift, ResultView.swift, HistoryRow.swift), plus DiceFoundryApp.swift and ContentView.swift
Checkpoint-11-Styling-Animation-Accessibility 11 the Checkpoint 10 files, plus Theme/Theme.swift and Assets.xcassets
Checkpoint-12-Debugging-and-Testing 12 the Checkpoint 11 files, plus Logic/DiceRoller.swift, and in DiceFoundryTests: DiceRollerTests.swift, RollResultTests.swift, HistoryStoreTests.swift
Checkpoint-13-Architecture 13 the Checkpoint 12 files, plus ViewModels/RollViewModel.swift and, in DiceFoundryTests, RollViewModelTests.swift
03-Solutions-and-Answer-Key/Final-Project-Solution 14 the Checkpoint 13 files, changed for the three required Chapter 14 features, plus DiceFoundryTests/FinalProjectTests.swift

Checkpoints 3 and 4 have the same file set as Checkpoint 1: those chapters change only ContentView.swift. Checkpoints 1 to 10 contain no asset catalog because the project template's default catalog is unchanged until Chapter 11. Checkpoint 2 includes your Chapter 2 practice file; later checkpoints omit it, and you may keep or delete yours.

The final file layout (after Chapter 13)

DiceFoundry/
  DiceFoundryApp.swift
  ContentView.swift
  Assets.xcassets/
  Models/        DieType.swift, RollResult.swift
  Logic/         DiceRoller.swift
  Persistence/   HistoryStore.swift
  ViewModels/    RollViewModel.swift
  Theme/         Theme.swift
  Views/         DieButton.swift, DiePicker.swift, RollOptionsView.swift,
                 ResultView.swift, HistoryRow.swift
DiceFoundryTests/
  DiceRollerTests.swift, RollResultTests.swift,
  HistoryStoreTests.swift, RollViewModelTests.swift

The Assets.xcassets catalog contains the colors AccentColor, BackgroundPrimary, BackgroundSecondary, CardBackground, Brass, Gold and OnBrass, and the AppIcon set.

Where each idea lives

Use this table to find the file that holds a responsibility, in the finished app.

Responsibility File
App entry point (@main) DiceFoundryApp.swift
The screen and its layout ContentView.swift and the files in Views/
What a die is (DieType) Models/DieType.swift
What a roll is (RollResult: subtotal, total, notation) Models/RollResult.swift
Random values and clamping (DiceRoller) Logic/DiceRoller.swift
Saving and loading history (HistoryStore, roll-history.json) Persistence/HistoryStore.swift
The screen's state and actions (RollViewModel) ViewModels/RollViewModel.swift
Colors, spacing and the card style Theme/Theme.swift and Assets.xcassets
Tests the DiceFoundryTests folder

The app icon files

The App-Icon folder contains the images you add to the app icon in Chapter 11.

File Use
AppIcon-Light.png The default icon: 1024 by 1024 pixels, opaque charcoal background, brass D20.
AppIcon-Dark.png The Dark appearance icon: transparent background.
AppIcon-Tinted.png The Tinted appearance icon: grayscale, transparent background.
Source-SVG Editable vector sources of the three icons.

The icons were created for this course. You may use or modify them freely in your own projects.

The diagrams

The workbook uses these diagrams: the roll flow (button press to saved file and screen update), the state and render loop, the Chapter 10 view hierarchy, the persistence flow, the architecture before and after Chapter 13, and the app launch sequence.

Which reference to use when

Situation Use
End of a chapter; checking your work Compare your files with the chapter's checkpoint.
Your project will not build and you cannot see why Compare file by file with the previous checkpoint; then follow the reset steps in "How to Use This Workbook".
Stuck on a challenge Hints in the Exercises document first; the Answer Key only after a real attempt.
Chapter 14 Work from your own Chapter 13 project; compare with Final-Project-Solution only after you finish, and explain each difference.
Unsure of Swift syntax The Quick Reference Guide, then the chapter named in its entry.
Reviewing AI-generated Swift The guide to reading and troubleshooting AI-generated Swift code.