<分区>
我知道 Xcode9 的早期 Beta 中缺少代码折叠,并且可以通过单击 CMD 来折叠整个方法。
但在 Xcode 8 中,我可以通过 Editor >> Code Folding >> Fold 将代码折叠成 block (即单独的 if 语句),但在 Xcode 9 中,这会折叠整个方法。
是否有我可以更改以恢复 Xcode 8 功能的修复/设置?
<分区>
我知道 Xcode9 的早期 Beta 中缺少代码折叠,并且可以通过单击 CMD 来折叠整个方法。
但在 Xcode 8 中,我可以通过 Editor >> Code Folding >> Fold 将代码折叠成 block (即单独的 if 语句),但在 Xcode 9 中,这会折叠整个方法。
是否有我可以更改以恢复 Xcode 8 功能的修复/设置?
最佳答案
更新 Xcode 10
Xcode 10 增加了对代码折叠的支持,包括:
Menubar ► Editor ► Code Folding ► Fold menu item
看看这个快照:
代码折叠在 Xcode 9 beta 1
中被禁用,根据 beta 发行说明,它现在可以在 Xcode 9 Beta5
中使用:Resolved in Xcode 9 beta 5 – IDE
方法如下:
⌘
(命令)按钮并将鼠标光标移动/悬停在任何(开始或结束)大括号上。它会自动高亮、遮挡区域。⌘
(命令)按钮处于按下状态,然后单击突出显示的区域。它将启用带有 Fold
选项的快速菜单弹出窗口。Fold
。它将折叠您的代码并显示 3 个点,折叠/覆盖整个 block 。⌘
(命令)按钮并单击折叠 block 的 3 个点。为了便于理解,请看这个快照:
所有键盘快捷键也都有效。
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
Xcode 菜单中的代码折叠选项:
Menubar ▶ Editor ▶ Code Folding ▶ "Here is list of code folding options"
这是引用快照:
来自 Xcode 快捷方式列表的相同选项:
Menubar ▶ Xcode ▶ Preferences ▶ Key Bindings ▶ "Here is list of code folding short-keys"
关于swift - Xcode 9/10 中的代码折叠更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46387262/
相关文章:
arrays - "Cannot Subscript a value of type ' [字符串] ' with an index of type ' 字符串 ' "
ios - 将 UITableView 样式更改为 "Grouped"导致崩溃
Xcode 9 : Multiple Working Copies Git
ios - Gif用作分页加载器时,有时不显示在 ImageView 中
ios - 适用于 IOS 的 Flutter 应用程序,是否可以在不使用 Xcode 的情况下设置 IOS "Legacy Build System"?