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 trialRobert Ledezma
705 PointsI copied and pasted the raw code from github and have an error with the line: switch self { Undeclared variable error
Wondering if anyone else had this issue. I figured I just typed something in wrong initially but when I copied the raw data I thought it would be resolved.
2 Answers
Austin Whitelaw
9,065 PointsYou may have moved past this already since it was a month ago but you need to check out the switch statement. Are you calling the switch within the extension? Is the switch part of the computed property of var text? If it says undeclared variable, I assume it is talking about self, and if you are using self within the extension, it should know what you are talking about.
I left out the specific cases for the switch, but it should look something like this: (of course I ignored all of the other code that was in between)
extension Story {
var text: String {
switch self {
}
}
}
Gary Melican
10,194 PointsSame happened to me...