Search code examples
iosswiftcocoa-touchuikitprogram-entry-point

Why the UIApplicationMain function is named as the class naming style


When I first saw the UIApplicationMain I though it was a class, because the initial letter of the name is written in upper case. While when reading the documents it turns out that it is a function. Any particular reasons that Apple has to names the UIApplicationMain function in the class naming style?


Solution

  • From Naming Functions in the "Coding Guidelines for Cocoa" (emphasis added):

    Function names are formed like method names, but with a couple exceptions:

    • They start with the same prefix that you use for classes and constants.
    • The first letter of the word after the prefix is capitalised.

    Here, UI is the prefix for the UIKit framework.