I want to know the steps, or perhaps the algorithm, the compiler uses to know an event happened? For example, how does it know a button has been pressed?
The compiler doesn't know anything about events. The compiler just translates your high-level source code into machine code.
This is within the realm of the runtime, which is affected by the operating system (iOS), controllers (view controllers) created by you, etc.
iOS uses the concept of "run loops" to process and handle events. Every iOS app will always have at least one such run loop, designated the "main" operation queue/thread, and possibly several in a multi-threaded app.
In a nutshell, the main run loop works kinda like this:
For more information, you should read Apple's documentation on Run Loops.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments