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 trialBrian Patterson
19,588 PointsNot sure why this is wrong
Not sure how to get this passing.
protocol User {
var name: String { get }
var age: Int { get set }
}
struct Person: User {
let somePerson: String
}
1 Answer
Michael Ayoub
7,689 PointsThe struct Person conforms to the protocol User so the struct must have the the properties that are in the protocol and then you must create an instance of Person and assign it to a constant named somePerson.
protocol User {
var name: String { get }
var age: Int { get set }
}
struct Person: User {
var name: String
var age: Int
}
let somePerson = Person(name: "Any name", age: 5 )