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 Build a Simple iPhone App with Swift 2.0 Getting Started with iOS Development Swift Recap Part 1

Brian Patterson
Brian Patterson
19,588 Points

Not sure why this won't compile

Not sure why this won't compile.

structs.swift
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
Gareth Borcherds
9,372 Points

You 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)

please 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
Gareth Borcherds
9,372 Points

It 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.

ah 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 :)