Is there a way to tell XCode fold methods/functions by default when opening a file?
相关问题
- Xcode debugger displays incorrect values for varia
- Image loads in simulator but not device?
- importing files from other directories in xcode
- XCode Server: Opening import file for module '
- create tableview inside tableviewcell using swift
相关文章
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Popover segue to static cell UITableView causes co
- “Storyboard.storyboard” could not be opened
- didBeginContact:(SKPhysicsContact *)contact not in
-
The file “
.app” couldn’t be opened becaus - How do I set compatible devices to only ARKit comp
Updates in Xcode 10:
Xcode 10 has increased support for code folding, including:
Look at this snapshot:
Code folding was disabled in Xcode 9 beta 1, which is working now, in Xcode 9 Beta5 according to beta release note: Resolved in Xcode 9 beta 5 – IDE
Here is how:
⌘
(command) button in keyboard and move/hover mouse cursor on any (start or end) braces. It will automatically highlight, block area.⌘
(command) button in pressed condition and click on highlighted area. It will enable quick menu popover window withFold
option.Fold
from menu list. It will fold your code and shows 3 dots, folding/covering entire block.⌘
(command) button and click on 3 dots folding a block.For easy understanding, look at this snapshot:
It's all keyboard short cuts are also working.
Code folding options from Xcode Menu:
Here is ref snapshot:
Same options from Xcode Short-cut list:
I don't think so, there are some handy keyboard shortcuts though:
The correct answer is in some of the comments (not in any of the answers, I don't think...
incidentally, the shortcut keys for this are here:
Judging from past answers, this must have changed over time. This is from Xcode 6.1.1.
For the sake of completeness,
If you want to fold / unfold specific blocks of code, since Xcode 7, you have to enable that.
Go to Xcode > Preferences > Text Editing > and check 'Code folding ribbon'.
(No idea why they disabled this useful feature by default.)
Not sure if this is an OS change, or an Xcode change, but on Lion with Xcode 4, some of these commands cited by Griffo are performed with the Option modifier (the ⌥ key), not control. I've made some changes to reflect this:
Sorry to necro a thread, but I thought this was worthwhile to revise.