Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Protocols in Swift Creating Flexible Objects Using Protocols Protocol Inheritance

Can someone help me, please? This could should work i don't know what is wrong.

It should be an easy fix

protocols.swift
protocol Animal {
    var numberOfLegs: Int { get }
}
protocol Pet: Animal  {
    var cuddlyName: String  { get }
}

2 Answers

I just typed this in the challenge and it worked:

protocol Animal {
    var numberOfLegs: Int { get }
}
protocol Pet: Animal {
    var cuddlyName: String { get }
}

Your code did not work in the challenge because the challenge is bugged. You typed 2 white spaces before Pet's curly bracket and before cuddlyName: String 's curly bracket. This doesn't change anything in Xcode but it affects the bugged challenge.

It works for me in Xcode.

Yeah, the code works in XCode but not in the challenge.