Just wondering if there is a way to enable spell checking in Xcode. Maybe an add-on or something...
You turn on spelling from the Edit menu (right at the bottom).
Edit: For code files, there's always the compiler, although that won't check comments, and won't stop you from spelling things wrong; it'll only stop you from spelling things inconsistently.
Reedit: In the 4 years since this was posted, the spell checker has moved a little: It is now under Edit > Format > Spelling and Grammar. Format is near, but not at the bottom.
In Xcode 4.5 you need to choose: Edit -> Format -> Spelling and Grammar -> Check Document Now (cmd + ;)
Put the cursor infront of your comment and press cmd ; this will jump to the next misspelt word.
For Xcode11
& Xcode12
, adding the screenshot for quick reference:
Some Tips:
Use the keyboard shortcut:
⌘
+;
together to move the cursor to the next spelling error.Tapping on
;
while holding⌘
cycles through all misspelled words.shift
+⌘
+;
to edit known words
You can also do: Edit > Format > Spelling and Grammar > Check Spelling While Typing. (Xcode 4.6.3)
Spell checking was broken in Xcode 9 and 10. It's now fixed in Xcode 11.0.
(Edit ► Format ► Spelling and Grammar ► Check Document Now)
Original answer below:
Unfortunately it doesn't work in Xcode 9 and 10. I posted a bug to Apple using "Bug Report". And it was marked as a dupe of a bug with number "32062963". And I found it here.
So if you want it works, PLEASE, POST A BUG! here.
Apple uses this to gauge how serious a bug is.
As it was mentioned here by Donarb.
As of Xcode 11 (tested in 11.3.1), if you turn on "Check spelling while you type", found in the Edit->Format->Spelling and Grammar menu, Xcode will display the red word spelled wrong indicator for comments as they are spelled wrong. It will also spell check camel case identifiers (much to my surprise). I am only just now using this so I don't know the sharp corners but it is exciting. As someone that is bilingual, I find myself mangling words. You can also set the preferred language using the "Show spelling and Grammar" option.
The Scribe plugin can do that (among other things). It's smart enough not to spell check code so you don't get a lot of false positives, and you can also right-click to get spelling suggestions.
Full disclosure: I'm the author of the plugin.
As of Xcode 15 you can enable global spell checking by going to Edit menu > Format > Spelling and Grammar > Check Spelling While Typing
. Such global check if off by default, but I see no downside to turning it on, only benefits.
If you do Xcode will highlight every typo with a red underline, both in comments and in camelCase variable and function names. And even suggest corrections.
Alternatively you can do a step-by-step spell check with ⌘
+ ;
.
UPD: Other cases such as snake_case, PascalCase, and kebab-case are also checked, but for Swift camelCase is the default one.
© 2022 - 2024 — McMap. All rights reserved.