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 trialKenneth Clark
973 PointsDoes the name of the struct have to match the file name?
In the example the file name is FactBook.swift and the struct is FactBook {}. Is it required they match?
3 Answers
agreatdaytocode
24,757 PointsHi Kenneth,
You can name it whatever you like :) If you do change it. Make sure you update the viewController
Greg Melson
3,037 PointsJust to add to Kenneth's answer, because I had a similar question. His answer helped me, but just to add to it
It's the struct name that you have to use in the viewController
So in the viewController code you declare your variable as an instance of the struct name, not the file name.
e.g. let yourVarialbeName = TheStructName()
Hope that also helps
Greg Melson
3,037 PointsJust to add to Kenneth's answer, because I had a similar question. His answer helped me, but just to add to it
It's the struct name that you have to use in the viewController
So in the viewController code you declare your variable as an instance of the struct name, not the file name.
e.g. let yourVarialbeName = TheStructName()
Hope that also helps