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 trialFlorian Groussin
4,563 PointsHow could I understand it?
Hello, I don't get this one at all but if someone could bring me a hint with his light it will be wonderful. I don't understand the question and don't get how I could return "UIFontTextStyleHeadline". Maybe by assigning to each case of the enum the corresponding constant?
The question must be as clear as my head is now, hope you can help me.
Thank you in advance and enjoy your day.
2 Answers
Jhoan Arango
14,575 PointsHello:
What you want to do in the computed property is a switch that will switch the enum as "self", and in each case you return the corresponding constant.
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
}
}
}
Good luck
Florian Groussin
4,563 Pointshello as you explain it it seemed so simple... Thank you very much for your help i think I will get it now :)
Enjoy the rest of the day pal