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 trial
Carldon King
iOS Development Techdegree Student 5,651 PointsHow can I better understand the plethora of "pre-made" classes and structs?
I don't know if I'm asking this question in the best way but I will do my best.
When using Xcode to create an app, I understand how to use enums, structs, classes, methods, initializers, etc. I'm still trying to get better at WHEN to use them and how to apply them. The major issue I'm having right now is trying to figure out everything that already exists in the Swift language within Xcode.
Example...when I start a single-view app and the ViewController is loaded for me, it is automatically a subclass of UIViewController. Now I know that I can Option click on it and open the pop-up and then click on the Reference and get additional information, but is there anyway that I can actually view UIViewController? I want to see the Class itself with it's declared variables and constants. It's methods, initializers and any overridden functions or initializers from IT'S superclass if it has one. Is there a map or flow chart of some sort that will allow me to see how the Superclass, or Base class if it is, was already arranged before I started using it?
I'm guessing that if I saw this information written out in code it would be overwhelming or maybe even hard to understand. If so, how can I make out what's available for me to use or how it works behind the scenes when I find it? I still don't even fully understand the viewDidLoad and didReceiveMemoryWarning overrides that are automatically entered or why I should put some code before it and some code after it because I have no other way to rationalize it other than "Monkey see, Monkey do."
1 Answer
Gabe Nadel
Treehouse Guest TeacherTo learn more about a class or method, right click and "Jump to Definition"...that will give you a good behind the scenes look at the class or method, but it will be in code and comments. This is a wildly useful route to go when trying to learn about pre-fabbed objects and methods, but also when trying to understand someone else's codebase.
Another really important place to look, is in the Apple Documentation. So, for UIViewController, you'd head to:
Or just go to the developer library and search for what you want: https://developer.apple.com/library/
Carldon King
iOS Development Techdegree Student 5,651 PointsCarldon King
iOS Development Techdegree Student 5,651 PointsWow! Thanks. This is EXACTLY what I was looking for. Now after I look at the Apple Documentation, I can also cross-reference the information with real code and gain a greater understanding hopefully, Thank you very much!