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 trialJack Hancock
3,613 PointsI have rewatched the videos in this course but I still have no clue how to do this task. I don't even know what Q to ask
I know this is not a question but I really don't know what I should do. I guess I don't know how to use the enum in a way that I can call up the style computed property. I wish there was some resources that I could be given on the task so that I wouldn't have to ask a question of this nature. Not sure how to even start.
let UIFontTextStyleHeadline = "UIFontTextStyleHeadline"
let UIFontTextStyleBody = "UIFontTextStyleBody"
let UIFontTextStyleFootnote = "UIFontTextStyleFootnote"
enum Text {
case Headline
case Body
case Footnote
var style: String{
}
}
2 Answers
rh12
4,407 PointsYou have made a good start. Here is a hint, try incorporating a switch statement into your style's computed property.
jon kelson
5,149 Pointscomputed properties . keep the “var style” switch statement in the curly braces body of the ” enum text” so you can call it like this “Text.Headline.style”
let UIFontTextStyleHeadline = "UIFontTextStyleHeadline" let UIFontTextStyleBody = "UIFontTextStyleBody" let UIFontTextStyleFootnote = "UIFontTextStyleFootnote"
enum Text { case Headline case Body case Footnote
var style: String{
switch self {
case .Headline: return "UIFontTextStyleHeadline"
case .Body: return "UIFontTextStyleBody"
case .Footnote: return "UIFontTextStyleFootnote"
}
}
}
Text.Headline.style