Is anyone having problem with code folding in Xcode 8? Every time I fold GameScene.swift
(or any other file), switch to, for example, AppDelegate.swift
, and switch back to GameScene.swift
(which were folded before), it unfolds.
Xcode unfortunately neither store nor remembers code folding. It actually resets folded parts after losing focus that file.
Since the code folding is reset all the time, I personally use this way of refolding:
To fold all the methods: Shift + Alt + Cmd + <- left
Place cursor onto the desired method and unfold it by clicking or using shortcut: Alt + Cmd + -> right
With Xcode-9, this issue is resolved. Code folding is being remembered and saved by Xcode 9 Editor.
Code you have/had folded exact before last source build/save, is automatically stored upon document/file closure. And same will be visible as it was (folded) when you will open document/file next time.
You don't need to do anything (there is no any option in Xcode tool bar to enable or disable) to save your code fold.
Here are some keyboard short cuts for code folding:
Fold ⌥ ⌘ ← option + command + left arrow
Unfold ⌥ ⌘ → option + command + right arrow
Unfold All ⌥ U option + U
Fold Methods & Functions ⌥ ⌘ ↑ option + command + up arrow
Unfold Methods & Functions ⌥ ⌘ ↓ option + command + down arrow
Fold Comment Blocks ⌃ ⇧ ⌘ ↑ control + shift + command + up
Unfold Comment Blocks ⌃ ⇧ ⌘ ↓ control + shift + command + down
Focus Follows Selection ⌃ ⌥ ⌘ F control + option + command + F
Fold All ⌘ ⌥ ⇧ ← command + option + shift + left
Unfold All ⌘ ⌥ ⇧ → command + option + shift + left
© 2022 - 2024 — McMap. All rights reserved.