opens - xcode open folder

Xcode keeps expanding all groups in the project navigator (4)

A great shortcut to expand/collapse all Xcode's groups folders is doing cmd + click on any of the group arrow

Since a couple days ago Xcode keeps expanding all the groups and subgroups in the project navigator.

I have repeatedly collapsed them so I can focus on what I'm working on and then I go back and they're all expanded again.

Has anyone else experienced this?

I collapse a group, move to a different tab in Xcode and then back and the groups are all expanded again.

It's really frustrating as I keep losing track of the files I'm working with.

I also was experiencing this annoying scenario in Xcode 9.2 where the project groups kept expanding themselves.

To fix it:

First, close your project in Xcode. (Otherwise, Xcode will replenish this file upon closing the project.)

Then delete the following file (or move the file somewhere else): [MyProject].xcodeproj/project.xcworkspace/xcuserdata/[MyUser].xcuserdatad/UserInterfaceState.xcuserstate

Remember to use the "Show Package Contents" option in Finder.

I wrote a shell script that gets rid of all these garbage files that sometimes make problems in xcode:

printf '\33c\e[3J'

RED=`tput setaf 1`
BLUE=`tput setaf 4`
NOCOLOR=`tput sgr0`

BASEDIR=$(dirname "$0")

echo "${BLUE}[XCode cache files pruner, created by Deya Eldeen Elkhawaldeh]${NOCOLOR}"
rm -R "$BASEDIR/$path1/"
rm -R "$BASEDIR/$path2/"

echo "${BLUE}Done,${NOCOLOR}"

it's hosted in github, maybe someday I will update it with more features,

In my case, I accidentally selected "Show only files with source control status" option in "project navigator". Check if you also selected this. Unselecting this option resolved my issue. Noticed this after searching for many answers on SO.