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.

Hemant Torsekar
167 Pointsswift_lint.swift:13:57: error: cannot convert value of type 'Tag.Type' to expected argument type 'Tag'
I've got no clue how this compiler expects me to finish this exercise.
swift_lint.swift:13:57: error: cannot convert value of type 'Tag.Type' to expected argument type 'Tag'
struct Tag {
let name: String
}
struct Post {
var title: String
var author: String
var tag: Tag
}
let firstPost = Post(title: "First", author: "Me", tag: Tag)
7 Answers

Steve Hunter
57,684 PointsHi there,
Your Tag
object needs creating; i.e. pass it a name
:
let firstPost = Post(title: "First", author: "Me", tag: Tag(name: "swift"))
Make sense?
Steve.

Steve Hunter
57,684 PointsHi Fiodar,
You're fine with your code except with the tag
parameter. The constructor for Post
takes three parameters. both title
and author
are of data-type, String
. In your example code you have passed in an empty string to those parameters, which is fine.
The third parameter, tag
needs an instance of data type Tag
. This means that you need to create an instance of Tag
in your call to the constructor of Post
. Currently, you have passed an empty string into the tag
parameter. If we look at the class itself, Tag
does only require a string to be 'complete'. However, we need to call the constructor.
So, just as you have called the Post
constructor by using the Post(title: "", author: "")
format, you need to do the same for the Tag
class. A Tag
wants a string so can be created with a constructor call like, Tag(name: "string")
.
Insert that into your creation of a Post
looks like:
let firstPost = Post(title: "", author: "", tag: Tag(name: "swift")
You may want to amend your first two strings to pass the tests the challenge is wanting, i.e. change the empty strings to something it is asking for - don't know. But, doing the above will pass an instance of Tag
into the Post
constructor, rather than just a string.
I hope that helps - let me know if you have questions. Just ask, I will try to help further.
Steve.

Kenneth Dubroff
10,612 PointsIt would be nice to have gone over the Tag type before this. It's not in the iOS beginner track. I tried sorting through it in Xcode, but Tag isn't recognized as a data type in Xcode 8. The only google posts pertaining to this mystery data type that came up in a quick google search were treehouse posts.

Steve Hunter
57,684 PointsHi Kenneth,
The Tag
type is a struct created at the top of this code challenge - it isn't an iOS thing.
You'll not find any docs on it for that reason. If you have any queries about how it works, just shout.
Steve.

Fiodar Shkolnikau
3,426 PointsThank you Steve!

Steve Hunter
57,684 Points
Kenneth Dubroff
10,612 PointsI see that now thanks. I came here to delete my comment lol

Steve Hunter
57,684 Points

Hemant Torsekar
167 PointsBecause the Tag needs to be set as well. Thanks Steve!

Steve Hunter
57,684 PointsNo problem - glad you got it sorted.
Steve.

Fiodar Shkolnikau
3,426 Pointsstruct Tag {
let name: String
}
struct Post {
var title: String
var author: String
var tag: Tag
}
let firstPost = Post(title: "", author: "", tag: "")
I Need help! Dont understand what to do with that tag, keep gettng an error on it.