Reputation: 951
I'm new to iOS dev (Java native) and I was kinda confused on how an app is compiled. I'm assuming it goes from the main.m
file in the Supporting Files folder, which hands off command to the AppDelegate
. Then depending on the state of the app (like didFinishLaunchingWithOptions
, or applicationWillResignActive
) it runs the commands in that method.
So if like my didFinishLaunchingWithOptions
sets the window.rootViewController
to another file - WXController
, for example, it then passes control to WXController
and runs all the methods in there in a sort of 'while-loop-esque
' way?
Is my understanding even close to how compiling and building actually is?
Upvotes: 0
Views: 114
Reputation: 4331
You did assume wrong. But this is neither the case for Java!
If you are interested what happens when you build your project, you can click in Xcode on your project file (usually the top most in the file menu, unless you are using workspaces). These are the project settings. One of it's tabs is calles 'Build Phases'. Here you can see listed what the compiler will do and in which order!
But to give you a quick introduction on how things work in C and C similar programming languages: There are the source files and the header files. Usually all source files ( the ones that contain your actual code in case of objective-C these are the .m-files) are compiled in random order (ofc. there is an order, but it is not important since the source files should never reference each other! ). The header files (.h-files) are used to tell the compiler about all the variables and methods that are supposed to be contained in other source files. This information will be kept as references while compiling the sources and then later used for linking everything together. After everything is compiled (result are the object files *.o),the references generated from the header files linker flags are used to link all your objects together.
Upvotes: 1