Class prefix missing in project template in Xcode 6.1

Previously, the class prefix field was used in the project template, which would help distinguish project classes from framework classes. This is no longer available in Xcode 6.1 project templates. What is the interest in this?

+7
source share
2 answers

According to some sources, Apple intentionally deleted this. They no longer encourage the use of prefixes for application code, arguing that the application code will not be reused and therefore will have little chance of name conflicts. See: http://scottberrevoets.com/2014/07/25/objective-c-prefixes-a-thing-of-the-past/

They only encourage it if you are designing a structure. For frameworks, you can add it using the project inspector: Why Xcode is not a file name prefix

I use the above method to add prefixes to my application because I find it tidier. In addition, if some structure that I ultimately use does not comply with the prefix convention, I can be sure that there will be no conflict with my code.

+18
source share

Here is my experience with renaming file names (Xcode v6.3):

  • Create a project called Hello:

    Created 2.Project Hello. Start renaming files in Navigator and in the source code - add the Hello prefix:

  • Then you need to change the class name in the source code of Interface Builder: RightClick to MainStoryboard β†’ Open As β†’ Source Code

  • Find the original class name and add the prefix Hello:

    NB! Ops I forgot to change the names in the main.m file - add the Hello to AppDelegate prefix:

+1
source share

All Articles