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 won't compile
Not sure why this won't compile.
struct Tag {
let name: String
}
struct Post {
let title : String
let author : String
let tag : Tag
}
let firstPost = Post(title: "Oliver Twist", author: "Charles Dickens", tag: Tag)
1 Answer
Gareth Borcherds
9,372 PointsYou need use the Tag struct and pass that in when you create a Post. So you need something like:
let newTag = Tag(name: "My Name")
and then
let firstPost = Post(title: "Oliver Twist", author: "Charles Dickens", tag: newTag)
Jad Milay
Courses Plus Student 810 PointsJad Milay
Courses Plus Student 810 Pointsplease if I may ask you, what the " MOD " in your profile picture, and why is it different from the rest of members, I got the green one is for the teachers, what about the orange one ? thanks
PS : sorry for the out topic
Gareth Borcherds
9,372 PointsGareth Borcherds
9,372 PointsIt stands for moderator. I'm a student here, but they've invited some of us that answer questions really well and can help other students to moderate the community and help out.
Jad Milay
Courses Plus Student 810 PointsJad Milay
Courses Plus Student 810 Pointsah okey, thats cool, thanks for giving the time to answer me my question :) and for the help you guys are providing to us as students :)