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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Hemant Torsekar](https://secure.gravatar.com/avatar/5f10dac75ffdb965a771f26e7a371acf?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
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](https://uploads.teamtreehouse.com/production/profile-photos/806282/micro_Ironman.jpg)
Steve Hunter
57,712 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](https://uploads.teamtreehouse.com/production/profile-photos/806282/micro_Ironman.jpg)
Steve Hunter
57,712 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](https://secure.gravatar.com/avatar/2f405e9fd88d699ab3bea7fe984aa836?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
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](https://uploads.teamtreehouse.com/production/profile-photos/806282/micro_Ironman.jpg)
Steve Hunter
57,712 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](https://secure.gravatar.com/avatar/9535110e4db8dd361173f0a8d3bbb8a0?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Fiodar Shkolnikau
3,426 PointsThank you Steve!
![Steve Hunter](https://uploads.teamtreehouse.com/production/profile-photos/806282/micro_Ironman.jpg)
Steve Hunter
57,712 Points![Kenneth Dubroff](https://secure.gravatar.com/avatar/2f405e9fd88d699ab3bea7fe984aa836?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Kenneth Dubroff
10,612 PointsI see that now thanks. I came here to delete my comment lol
![Steve Hunter](https://uploads.teamtreehouse.com/production/profile-photos/806282/micro_Ironman.jpg)
Steve Hunter
57,712 Points
![Hemant Torsekar](https://secure.gravatar.com/avatar/5f10dac75ffdb965a771f26e7a371acf?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Hemant Torsekar
167 PointsBecause the Tag needs to be set as well. Thanks Steve!
![Steve Hunter](https://uploads.teamtreehouse.com/production/profile-photos/806282/micro_Ironman.jpg)
Steve Hunter
57,712 PointsNo problem - glad you got it sorted.
Steve.
![Fiodar Shkolnikau](https://secure.gravatar.com/avatar/9535110e4db8dd361173f0a8d3bbb8a0?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
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.