Challenge: Design a quiz in Swift Playgrounds

Hammer symbol and paint brush symbol

Do the people in your life know your favorite animal noise? How about the book that changed your life? Your least favorite pizza topping? Design a “How well do you know me?” quiz to see who knows the most about your quirks and interests.

Begin the challenge

This challenge invites you to create a quiz using the Answers book in Swift Playgrounds. Your “How do you know me” quiz should ask a series of questions and ultimately return a score (and possibly a colorful description!) based upon how many questions were answered correctly.

To get started, download and open Swift Playgrounds on your iPad or Mac, then select See All from the lower right corner to launch the Swift Playgrounds content screen. From here, you can find the Answers book under “Starting Points” and download a copy to your device.

Use the Swift Playgrounds app to download the Answers book for this challenge.

Use the Swift Playgrounds app to download the Answers book for this challenge.

The Answers starting point contains a page called “API Overview,” which dives into the API for this playground. You can use the show call to display text or images, and use several different ask calls to request feedback from the player and store their response as variables. You can use the combination of these API calls to build up your own custom quiz questions and check responses against your own answer key.

You can use Answers to build all sorts of different text-based trees and quizzes, and if you feel strongly about making a different type of quiz, please do! We highly encourage you to explore different ways of using this starting point to make something that you’re excited about. And if you’d like to share what you’ve built with the community, post a video of your quiz in action or share a link in the Developer Forums.

Visit the Apple Developer Forums

Resources

Download Swift Playgrounds for macOS

Learn more about Swift Playgrounds

Read the WWDC21 Challenges Terms and Conditions