Why Xcode is not a file name prefix

Hi guys,

when I run an application project with one iOS view, the AppDelegate files and ViewController files are not prefixed with the project name, as they used to.

The file names are as follows when I open a new project:

AppDelegate.h
AppDelegate.m
MainStoryBoard.storyboard
ViewController.h
ViewController.m

Why is this?

+3
xcode
source share
3 answers

You must add it manually. When you create a new project, just fill in the “Class Prefix” field on the screen where you name the project / package ID / etc ..

Just add the prefix where I wrote “THIS PREVIOUS” in the screenshot below

enter image description here

If you want to add a prefix after creating the project, you can do this in the file inspector in the right pane of Xcode:

enter image description here

+15
source share

Personally, I prefer not the class name prefix in the application.

When you write code for libraries or custom classes or categories, they are recommended because there are no namespaces in Objective-C.

But for application classes, I think they are just noises. Looking down at the list of files that have all three letters in front, it’s a little harder to find what I’m looking for.

I mean, will you really have more than one class called AppDelegate? I am all for the full and descriptive naming of my classes, but the prefixes for all classes do not help me.

If this helps, there are several conventions for writing code. Search and you will find them. Here are mine , for example.

You do not have to follow them, but choose a style and agree with it.

+4
source share

Xcode 8 does not have a Class Prefix field. It has only a "Product Name", and this does not scare the view controller or application delegate. I think 8.3 has errors.

+1
source share

All Articles