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!

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 Swift Enums and Structs Structs and their Methods Review and Final Exam

Aside from scope, is there any reason that I'd _not_ want to declare the enum within the struct?

My solution to the exam/challenge had the enum Status within the struct Task.

Other than losing access to Status due to scope, is there any reason I would not want to declare the enum within the struct? Or, is it irrelevant and just a different way to solve the quiz?

1 Answer

Soojin Ro
Soojin Ro
13,331 Points

Losing access to scope is pretty much the whole reason. I think there is no point of declaring enum if no one can use! Of course there might be rare cases where you only need enum within struct but very unlikely.

Thanks! I figured that was the case but I wasn't sure if there was any other impact to performance or something like that.