61

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?

pkamb
  • 33,281
  • 23
  • 160
  • 191
Logan
  • 1,172
  • 9
  • 23
  • this is happening to me too! its so annoying. Im also searching for a solution – 1ak31sha Jun 24 '16 at 00:16
  • @user2464951 thought I was the only one! If I get a solution I'll update it here. For now, I been just closing all folders by highlight the top directory and holding option + left arrow key. But it's so frustrating still – Logan Jun 25 '16 at 00:53
  • Possible duplicate of [Xcode remember what folders were collapsed / opened](http://stackoverflow.com/questions/19223633/xcode-remember-what-folders-were-collapsed-opened) – miken32 Aug 10 '16 at 20:00
  • This is a bug and still unresolved. Please dupe the issue at http://openradar.appspot.com/32787072 on http://bugreport.apple.com – Tricky Jun 21 '18 at 22:28

5 Answers5

109

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

Gowthaman M
  • 8,057
  • 8
  • 35
  • 54
Lixiang
  • 1,108
  • 1
  • 8
  • 5
57

I found a solution for this from another posted question.

Delete this file...

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

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

Community
  • 1
  • 1
G. Car...
  • 571
  • 5
  • 5
  • Sorry but after deleting this file, Xcode 9 keeps expanding all project folders e.g., when I add a new file or group to the tree. ¿Any ideas?. Even if I delete this file, and relaunch Xcode, all folders keep expanded. It's very annoying – Jorge Ramos Jan 04 '18 at 06:42
  • 4
    To make this work on Xcode 9, I had to delete the entire myusername.xcuserdatad directory. Otherwise as @AaronWright said, it is only a temporary fix. – Guillaume L. Feb 12 '18 at 10:49
  • Deleted the file but still same issue – Mujahid Latif Sep 10 '18 at 06:07
4

With CocoaPods, delete this:

MyProjectName.xcworkspace > xcuserdata > myusername.xcuserdatad > UserInterfaceState.xcuserstate
Dmitry Isaev
  • 3,888
  • 2
  • 37
  • 49
  • 1
    I wasn't using CocoaPods, but I still had an .xcworkspace outside of the project directory and this was the right answer. – Chase Finch Aug 20 '18 at 13:30
4

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

Screenshot from XCode

Josh Mein
  • 28,107
  • 15
  • 76
  • 87
1

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

Mujahid Latif
  • 596
  • 7
  • 18