Xcode Folders Auto-Expanding When Clicking "Project Navigator"

Xcode

Xcode Problem Overview


Every time I re-open the Project Navigator tab in the left side of Xcode (I.E move away from it into another tab and come back to it), my folders and subfolders all "magically" expand on their own. I can't seem to figure out what the problem is. It's getting really frustrating collapsing them on my own every time (even with the option-Arrow Key short cut).

Has anyone else experienced this?

Xcode Solutions


Solution 1 - Xcode

Input any number of letters in the File filter, then close your Xcode immediately, then reopen your Xcode, then you will see the magic

Demo

enter image description here

Solution 2 - Xcode

I found a solution for this from another posted question.

Delete this file...

MyProjectName.xcodeproj > project.xcworkspace > xcuserdata > myusername.xcuserdatad > UserInterfaceState.xcuserstate

https://stackoverflow.com/questions/19223633/xcode-remember-what-folders-were-collapsed-opened

I also had a similar issue with the search filter for an asset catalog failing to clear. Deleting the .xcuserstate file solved that as well

Solution 3 - Xcode

With CocoaPods, delete this:

MyProjectName.xcworkspace > xcuserdata > myusername.xcuserdatad > UserInterfaceState.xcuserstate

Solution 4 - Xcode

The solution is to click the square in the red circle. Maybe you accidentally clicked it without knowing that

Screenshot from XCode

Solution 5 - Xcode

In my case @G.Car... and @Younes Rouabah answers did not work alone. But both done the trick

Step 1: Delete File

MyProjectName.xcodeproj > project.xcworkspace > xcuserdata > myusername.xcuserdatad > UserInterfaceState.xcuserstate

Step 2: Restart XCode

Step 4: Click the square in the red circle

enter image description here

Restart XCode Again

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLoganView Question on Stackoverflow
Solution 1 - XcodeLixiangView Answer on Stackoverflow
Solution 2 - XcodeG. Car...View Answer on Stackoverflow
Solution 3 - XcodeDmitry IsaevView Answer on Stackoverflow
Solution 4 - XcodeYounes RouabahView Answer on Stackoverflow
Solution 5 - XcodeMujahid LatifView Answer on Stackoverflow