Code Folding Ribbon?

Where is the code folding ribbon in Xcode 9? I cannot believe this is not in the public release version. I've been using this for years to fold inner loops of code to make it easier to edit and it adds so much time to my projects without it. Please bring back!!!

Replies

The code folding feature itself is still there. Just the ribbon is gone.

(Editor --> Code Folding)

It only folds the top level. So if I want to fold an if statement inside of a function it isn't possible. DUMB!!!

Just press command and hover over the part you want to fold, at the beginning or end of line.


Then the code is marked in blue. Click and select "Fold".


This fold any sublevel.

This doesn't work. I have tried everything. Xcode 9.0.1 and 9. It only highlights the top level. It will not do an if statement inside of a function.

I tested on 9.1 beta2. I can guarantee it works with command-click.

In this example, when I command-hover over :

- the if or the { of if numberIncluded <= maxToGet {

- or on the } at the end of if statement

- or on { or else or } of } else {

I get the complete if statement hihlighted and nothing else. If I click and select fold, I get the

if let name = nameOfItem(seqNum: i) { ••• }, with a small ribbon the left.


func getNamesOfItems(forSet : Set<Int>, separator: String, truncateAfter: Int?) -> String {

    let maxToGet = truncateAfter ?? kMaxAbsoluNumberOfItems
    var numberIncluded = 0

    var s = ""
    for i in 0..<10 where forSet.contains(i) {
        if let name = nameOfItem(seqNum: i) {
            if s != "" { s += separator }   // Ce n'est pas le premier nom
            numberIncluded += 1
            if numberIncluded <= maxToGet {     // command-hover here
                s += name
            } else {                            // command-hover here
                s += " …"
                break
            }                                   // command-hover here
        }
    }
    return s
}


Could not test on 9.0.


So the good news seems to be that 9.1 does improve code folding.

As you can see by the same action on the outer function and if do not work the same. No highlight. Perhaps it is the face that it is Objective-C?

Apparently you can't add images... But it doesn't work. I have been developing 21 years, I'm not a newbie, fyi.

We don't know who we are each of us !


I didn't assume you were a newbie, but maybe the folding was working in 9.1 that you may not yet have installed.


However, it was not said in your post that it was ObjC, hence the quiproquo.

That may well be the explanation. Should try with 9.1 to be sure.

It does not work with Objective C code even in the newest beta. Only works with swift code.

Code Folding still does not work as it should with C,C++ or Objective C code in 9.3 Beta 3

It was huge mistake to release version without normal folding. Apple should to fix this asap

I agree, very rough without it if you are used to using it. Surely it is coming back. Why remove such a useful tool?