Xcode Swift code folding/collapse

前端 未结 5 1604
暗喜
暗喜 2020-12-28 14:10

I know we can use \"Shift + Alt + Cmd + Left\" to fold/collapse swift code in Xcode, but can anyone tell me how to fold/collapse for functions only?

5条回答
  •  清歌不尽
    2020-12-28 14:24

    Code Ribbons at the rescue for SwiftUI

    It is a great feature to have. It seems too few developers know about this. Especially when writing code in SwiftUI, I like to see that my code works before refactoring it into separate views.

    Folding is a great tool to have.

    Here an example in Xcode 12. It is not active by default but you need too check the box "Code Folding Ribbon" in the preferences:

    and you can fold nested views as deep as you like, with animation:

提交回复
热议问题