In your example, it's important to remember that while there are seemingly endless amounts of tutorials, etc. on the 'net etc. the tools advance at a rate that tends to obsolete them very quickly.
For newbies, this presents a mine field of liability where the skill to know how to tread is typically missing.
In your case, you may want to start by stating which version Xcode you're using, and by quoting any errors, specifically, rather than paraphrasing. Feel free to add a bit of the related code to your question. See: For Best Results - Read the Label
As well, until you get your feet underneath you, it might be better to stick with Apple's tutorials, direct from the mothership.
About use of undeclared type, there can be a raft of issues - see this SO thread for examples:https://stackoverflow.com/questions/38515522/swift-use-of-undeclared-type?rq=1
...but again, without seeing your code, it's hard to even guess.
Good luck.