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 trialWill Van de Walle
2,352 PointsDescription in code challenge incorrect?
My code is as followed. It is telling me to make sure that the "implementation of the description matches the challenge". I have checked over it several times; can't seem to figure out what is wrong here. Help?
struct Tag {
let name: String
}
struct Post {
let title: String
let author: String
let tag: Tag
func description() -> String{
return "\(title) by \(author). Filed under \(tag)"
}
}
let firstPost = Post(title: "I", author: "g", tag: Tag(name: "fad"))
let postDescription = firstPost.description()
4 Answers
Jennifer Nordell
Treehouse TeacherHere's the culprit! When you're interpolating the tag name you need to use tag.name.
return "\(title) by \(author). Filed under \(tag.name)"
Cindy Lea
Courses Plus Student 6,497 PointsWhats the actual question in the challenge?
Jennifer Nordell
Treehouse TeacherCynthia Arnow You can find a link to the challenge at the top of the page. You should see a green button that says "View Challenge".
Will Van de Walle
2,352 PointsThanks! I figured it out soon after I posted this question; seems like that's always the case. :) Thanks anyway, especially to Jennifer Nordell!
Will Van de Walle
2,352 PointsThanks! I figured it out soon after I posted this question; seems like that's always the case. :) Thanks anyway, especially to Jennifer Nordell!