Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Monika Kesarwani
5,851 Pointsstructure i dont know where I m doing mistake in making instance of structure
struct Tag { let name: String }
struct Post{ var title: String var author: String var tag = Tag() }
let firstPost = Post(title: "Dove", author: "Monika", tag: Tag(name: "MyTag"))
struct Tag {
let name: String
}
struct Post{
var title: String
var author: String
var tag = Tag()
}
let firstPost = Post(title: "Dove", author: "Monika", tag: Tag(name: "MyTag"))
1 Answer

Steven Parker
216,744 PointsIn the defintion of "Post", you only need to define the argument "tag" by the type instead of creating an instance and performing an assignment:
var tag: Tag
Happy coding! And for some holiday-season fun and extra practice, give Advent of Code a try!
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherWoops! I composed an answer but will remove it as you've gotten a very solid one from Steven Parker! And he's correct, the Advent of Code is awesome