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

Will Van de Walle
Will Van de Walle
2,352 Points

Description in code challenge incorrect?

My code is as followed. It is telling me to make sure that the "implementation of the description matches the challenge". I have checked over it several times; can't seem to figure out what is wrong here. Help?

structs.swift
struct Tag {
    let name: String
}

struct Post {
  let title: String
  let author: String
  let tag: Tag
  func description() -> String{
    return "\(title) by \(author). Filed under \(tag)"
  }

}

let firstPost = Post(title: "I", author: "g", tag: Tag(name: "fad"))

let postDescription = firstPost.description()

4 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Here's the culprit! When you're interpolating the tag name you need to use tag.name.

 return "\(title) by \(author). Filed under \(tag.name)"
Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Cynthia Arnow :information_source: You can find a link to the challenge at the top of the page. You should see a green button that says "View Challenge".

Will Van de Walle
Will Van de Walle
2,352 Points

Thanks! I figured it out soon after I posted this question; seems like that's always the case. :) Thanks anyway, especially to Jennifer Nordell!

Will Van de Walle
Will Van de Walle
2,352 Points

Thanks! I figured it out soon after I posted this question; seems like that's always the case. :) Thanks anyway, especially to Jennifer Nordell!