WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

Checkpoint 7: STUCK!

Forums > 100 Days of SwiftUI

I know I'm doing something horribly wrong! Just can't seem to put a finger on it. Need help!

My code for checkpoint 7:

class Animals {
    var legs: Int

    init(legs: Int) {
    self.legs = legs

class Dog : Animals {

    func dogSpeak() {

class Corgi : Dog {
    override func dogSpeak() {

class Poodle : Dog {
    override func dogSpeak() {

class Cat : Animals {
    var isTame: Bool
    init(isTame: Bool, legs:Int) {
    super.init(legs: legs)

    func catSpeak() {

class Persian : Cat {
    override func catSpeak() {

class Lion : Cat {
   override func catSpeak() {


If you paste your code into Playgrounds and build it, what error code do you get?

One of the skills you start to develop is how to read and interpret the compiler's complaints! Get used to it!

When I pasted your code into Playgrounds, the compiler complained about the Cat class:

Property 'self.isTame' not initialized at super.init call

Looking at your cat class, you'll note that all Cats should have a leg count, and also be identified as being tame or not.

You created an initializer for the Cat class. What exactly are the inital values for each property in a Cat object?

Create a blank cat object on paper. Then work through the steps to initialize a NEW cat object. After you initialized it, WHAT ARE THE VALUES?

Please return here and let us know what you found out!


Hacking with Swift is sponsored by Emerge

SPONSORED Why are Swift reference types bad for app startup time, and what’s the performance cost of protocol conformances? That’s just a couple of the topics you can learn about on the Emerge blog — written by the app performance experts behind Emerge’s advanced app optimization and monitoring tools, based on their experience of working at companies like Apple, Airbnb, Snap, and Spotify.

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.