Why this happens
Xcode’s source editor uses theme-controlled fonts. A theme assigns formatting to categories such as plain text, comments, documentation comments, and keywords. Changing the font for one category does not necessarily change the others, which can leave comments larger while the rest of your code stays small.
Older Xcode releases also restrict changes to built-in themes. If you try to modify a protected theme, you may need to duplicate it first. Opening the standard macOS Font panel alone does not identify which source-editor categories should receive the change.
There are two useful approaches: use the editor’s font-size shortcut for a quick adjustment, or edit a theme for explicit control over the font and size. The shortcut is available starting with Xcode 9; the theme-based approach also covers older releases.
How to fix it
1. Increase the size directly in the source editor
For Xcode 9 and later, start with the keyboard shortcut:
- Open a Swift, Objective-C, or other source file.
- Click inside the code editor so it has keyboard focus.
- Press Command–Plus (+) to increase the font size.
- Repeat until the code is comfortable to read.
On a US keyboard, typing the plus character normally requires Shift, so the physical key combination is Command–Shift–Equals. Keyboard layouts differ; the important character is +, not the unshifted equals sign.
Use Command–Minus (-) to decrease the size if you go too far.
Make sure the insertion point is in the source editor before testing the shortcut. If focus is in the project navigator, a search field, or another pane, you are not testing the source editor’s response.
If the shortcut does nothing, use the theme settings below. They also let you choose a specific point size instead of adjusting by repeated key presses.
2. Open the font controls for the selected theme
The settings labels depend on your Xcode release:
- In newer releases, open Xcode > Settings and select Themes.
- In older releases, open Xcode > Preferences and look for Fonts & Colors.
Select the theme you want to use, then locate its source-editor formatting controls. These are the controls for code text, rather than unrelated interface text elsewhere in Xcode.
If Xcode prevents you from changing a built-in theme, duplicate it using the theme list’s duplication control or the prompt Xcode provides. Select the new copy before continuing.
A custom theme is also useful when duplication is optional: it preserves the original appearance as a reference. Give the copy a recognizable name so you can distinguish it from the built-in theme later.
Do not keep retrying Format > Font as a substitute for selecting a theme and its text categories. In the older workflow described by this problem, that route did not reliably change the source editor’s theme-controlled font.
3. Select every source-editor text category before changing size
This is the important step when font changes appear to have no effect—or affect only part of a file.
- Find the list of source-editor text categories in the theme settings.
- Click an entry in that list to give the list focus.
- Press Command–A to select all categories.
- Open the font control associated with those selected entries.
- Set the desired font size.
Depending on the Xcode release, the font control may show the current font name and size, with a small T button that opens the Font panel.
For example, you could select Menlo Regular, 14 pt as a readable starting point. That is a preference, not a required value. Choose a size that works for your display and viewing distance.
Selecting all categories first ensures that comments, keywords, strings, and ordinary code receive the size change together. If nothing is selected, the Font panel can be visible without having a useful target for your edit.
If you want to preserve existing font families or styles, change only the size where the controls allow it. Choosing a complete font face for every category intentionally makes their typography more uniform; it is a separate choice from merely enlarging the text.
4. Verify the result in an actual source file
Return to a source file that contains several kinds of text. A Swift file with comments, string literals, declarations, and ordinary expressions is enough.
Check the following:
- Comments and code are both larger.
- String literals are not unexpectedly smaller than surrounding text.
- The custom theme you edited is still selected.
- The file you are inspecting is open in the source editor, not another pane.
If only comments changed, return to the theme settings and select all source-editor categories before adjusting the size again. If nothing changed, confirm that you edited the active theme rather than an unselected copy.
You do not need to change your Swift code, project build settings, or dependencies for this fix. Editor typography is an Xcode preference, not a property of the app you are building.
5. Restore the original appearance if needed
If the custom theme becomes difficult to read, select the original built-in theme again. This is the main advantage of making a copy before editing: you retain a known starting point without having to reconstruct its settings.
If you only enlarged the editor with the keyboard shortcut, use Command–Minus to reduce it. For an exact target size, return to the theme’s font controls rather than trying to remember how many shortcut presses you used.
How to prevent it
- Duplicate a built-in theme before making substantial font or color changes.
- Select all source-editor categories when you want a uniform size adjustment.
- Use a recognizable custom-theme name so you can identify the active configuration.
- Keep editor font changes separate from app typography; changing Xcode does not change your app’s fonts.
- Prefer the keyboard shortcut for quick adjustments and theme settings for a specific font or point size.
FAQ
Why does Command–Plus not increase the font size?
First click inside a source file and check that your keyboard combination produces the plus character. The shortcut was added in Xcode 9, so older releases require the theme-settings approach. If it still does not respond, adjust the source-editor font directly in the active theme.
Why did only my comments get bigger?
Xcode stores font formatting by source-editor text category. You probably changed the comments category without selecting the others. Select all entries in the source-editor category list, then apply the size again.
Do I need to close my project before changing fonts?
Usually, start with the project open so you can inspect the result immediately. The older Xcode 4.1 workflow included closing projects to make the Font panel accessible; that is a historical workaround, not a general requirement for newer Xcode releases.
Parts of this guide are adapted from content licensed under CC BY-SA 3.0; this article is shared under the same license.
