Dice Foundry Solutions and Answer Key

Exercise Solutions and Answer Key

This document contains the answers to the Dice Foundry course: Knowledge Check answers, complete solutions to the Independent Challenges, and answers to the extra practice exercises, for Chapters 1 to 14. It ends with the Chapter 14 final project solution source.

Warning: Try first

Reading a solution before you have attempted the exercise removes most of its value. Use the hints in the Exercises document first. Come here after you have a solution of your own, or after a real attempt that did not work.

What is in each chapter's section

Part What it gives you
Knowledge Check Answers Short answers with explanations, matching the numbered questions at the end of each chapter.
Challenge Solutions The exact file and location to change, the code, an explanation of why it works, and alternatives.
Extra Practice Answers Answers to the predict, spot-the-bug, trace and modify exercises in the Exercises document.

How to use the answers

  • Compare reasoning, not only results. A different solution can be correct. Check that yours meets every acceptance criterion in the challenge, then read the explanation to see what the solution is optimizing for.
  • Run both. If your solution works, keep it on your challenge branch. If you try the Answer Key's solution, do it on the challenge branch as well and return to main afterward, so the guided project stays identical to the reference.
  • Treat wrong predictions as information. Where your answer to a tracing exercise differs, find the line where your mental model and the code part ways.
  • Knowledge Check answers are short. If an answer is not clear, go back to the chapter section it names.

What "Verified" means here

Some challenge solutions say: "Verified: compiles with 0 errors and 0 warnings (Xcode 27.2, iOS 17.0 target)." That statement means the author built that solution with those settings and saw no errors and no warnings. It does not mean the solution was tested on a physical iPhone, or that every behavior was checked beyond the build and, where stated, the unit tests. A solution marked "Not compile-tested" was not built by the author; build it before you rely on it.

The Chapter 14 solution was compiled with 0 errors and 0 warnings and tested with the course toolchain. Its complete source is at the end of this document, listing the files that differ from Checkpoint 13. The full project is in the Final-Project-Solution folder inside 03-Solutions-and-Answer-Key.

Important: The Final Project Solution is source files, not an Xcode project

Like the reference checkpoints, the Final-Project-Solution folder contains Swift source files and no .xcodeproj file. To run it, copy its files into a project of your own, as described in "How to Use This Workbook" under "Catching up from a checkpoint", or compare it with your own Chapter 14 work.

Using the Chapter 14 rubric

Chapter 14 has a Self-Assessment Rubric. Score your own work against it before you read the solution. Then compare, and for every meaningful difference between your project and the solution, write down which of the two you would defend in a code review and why. Being able to explain a difference is a better sign of understanding than matching the solution.