Search code examples
swiftxcodeformattingxcode13

Adding lines to parenthesis in Xcode as others code editors


how can I add lines to my code on Xcode as other code editors like the image below?

enter image description here


Solution

  • how can I add lines to my code on Xcode as other code editors like the image below?

    You can't, because Xcode doesn't render code that way. However, those vertical lines are often used to indicate which lines will be collapsed or folded, and Xcode does support code folding:

    sample code with folding bars

    The vertical gray bars next just to the right of the line numbers are Xcode's way of showing how code is nested. If you place the cursor over one of those bars, Xcode highlights the beginning and ending braces. Clicking on a bar will fold the corresponding block down to a single line with ... between the braces. This is similar to what the vertical indentation lines do in some other editors.