Fix Xcode 8 Comment Shortcut Not Working
If the comment shortcut in Xcode 8 is not working, you can try the following solution:
- Make sure the cursor is on the line of code you want to comment. Sometimes, if the cursor is not on the code line, the shortcut for commenting may not work.
- Check the shortcut key settings in Xcode to ensure they are correct. Select “Xcode” -> “Preferences” from the Xcode menu, then click on the “Key Bindings” tab to make sure the shortcut key for commenting is set correctly. By default, the comment shortcut key is “Command + /”.
- Check if the keyboard layout is correct. Sometimes an incorrect keyboard layout setting can cause the shortcut keys for commenting to be ineffective. In the “Keyboard” option under “System Preferences”, make sure the keyboard layout setting is correct.
- Restart Xcode. Sometimes restarting Xcode can resolve some strange issues.
If none of the above methods work, it may be a bug in Xcode. You can try upgrading to the latest version of Xcode, or search for the issue on Apple’s developer forum to see if other users have encountered the same problem and found a solution.