Code Style. C/C++/Objective C
Use this page to configure formatting options for C, C++, Objective C files. View the result in the Preview pane on the right.
On this page:
- Set from
- Tabs and Indents
- Wrapping and Braces
- Blank Lines
- Code Generation
Click this link to choose the base for the current language default code style from the pop-up list, that appears. The list contains the following options:
|Language||Choose this option to inherit the coding style settings from another language. Select the source language from the list, that opens. So doing, only the settings that are applicable to the current language are taken. All the other settings are not affected.|
Choose this option to use the coding styles defined for a specific framework or coding standard.
Select one of the following standards from the list.
Note: the coding styles of the below set affect only the certain items of base settings and leave the rest of them unchanged.
The following styles of the list are applicable for braces placement only:
Tabs and Indents
Use this tab to specify where you want spaces in your code. To have AppCode automatically insert a space at a location, select the check box next to this location in the list. The results are displayed in the Preview pane.
Wrapping and Braces
In this tab, customize the code style options, which AppCode will apply on reformatting the source code. The left-hand pane contains the list of exceptions (Keep when reformatting), and placement and alignment options for the various code constructs (lists, statements, operations, annotations, etc.). The right-hand pane shows preview.
Alignment takes precedence over indentation options.
Right Margin (columns)
Use Right Margin field to specify a margin space required on the right side of an element. If you select Default option then a value of the right margin from the global settings is used.
Wrap on Typing
Use Wrap on typing settings to specify how the edited text is fitted in the specified Right margin. You can select one the following options:
- Default - in this case AppCode uses the Wrap on typing option that is specified in the global settings.
- Yes - in this case AppCode uses the value specified in the Right Margin field.
- No - in this case this option is switched off and a line can exceed the value specified in the right margin.
Keep When Reformatting
Use the check boxes to configure exceptions that AppCode will make when reformatting the source code. For example, by default, the Line breaks check box is selected. If your code contains lines that are shorter than a standard convention, you can convert them by disabling the Line breaks check box before you reformat the source code.
The wrapping style applies to the various code constructs, specified in the left-hand pane (for example, method call arguments, or assignment statements).
|Wrapping style||From this drop-down list, select the desired wrapping style:
Braces Placement Options
Use this tab to define where and how many blank lines you want AppCode to retain and insert in your code after reformatting. For each type of location, specify the number of blank lines to be inserted. The results are displayed in the Preview pane.
|Keep Maximum Blank Lines||In this area, specify the number of blank lines to be kept after reformatting in the specified locations.|
|Minimum Blank Lines||In the text boxes in this area, specify the number of blank lines to be present in the specified locations.|
Use this tab to configure formatting options for generated code.
|Line comment at first column||Select this check box to have generated line comments placed in the first column.|
|Block comment at first column||Select this check box to have generated block comments placed in the first column.|
|Prefix for instance variables
Suffix for instance variables
|In these text boxes, type the prefixes and suffixes to be used when generating instance variables.|
|Retain object parameters in initWith...||Select this check box to retain object parameters when generating initWith. This option will not work unless Automated Reference Counting is disabled.|
|Use property setters in initWith...||Select this check box to use property setters when generating initWith. This option will not work unless instant variable has a synthesized property.|
|Semicolon after method signature in implementation||Select this check box to insert a semicolon after method signature when generating method implementation.|
|Put ivars to implementation if possible||Select this check box to insert instant variables where possible when generating implementation.|
|Use NSInteger and CGFloat in introduce variable||Select this check box to use NSInteger and CGFloat in introduce variable. Otherwise int and float will be used.|
|Ivars release style (for 'dealloc')||
Choose instant variables release style for dealloc method. The available options are:
|Generate ivar declarations for properties||
Choose the behaviour for generating instant variable declarations for properties. The available options are:
|Prefix for fields||> Type the prefix that will prepend a name of an automatically generated field.|
|Suffix for fields||Type the suffix that will be appended to a name of an automatically generated field.|
|Prefix for getters||
Type a prefix that will prepend a name of an automatically generated getter. The default name is |
|Prefix for setters||
type a prefix that will prepend a name of an automatically generated setter. The default name is |
Prefix and Suffix for fields settings are intended for refactorings and are not applicable for the code generation.