iosxcodecocoapods

Prevent XCode from collapsing my folders whenever workspace file is rebuilt with CocoaPods


Whenever I add a CocoaPod to my workspace using pod install, the folders tree on the left navigator collapses to the root. This is very annoying because I am working in a project with a deep folder structure. I realize its a minor inconvenience, but is there any way to prevent this from happening?

EDIT: So, I have a workspace that already has been setup with CocoaPods via pod install. I want to add a new pod. So, I vim Podfile and then pod install (or sometimes pod update).

In the meanwhile, since the last pod install, I've done some work. I have some tabs open in my XCode workspace, and each tab has its own left navigation view that shows a hierarchical representation of my workspace. You know, something like this:

A left navigation pane

If it matters, I take great care to ensure that my project has groups that are strictly representative of file system folders - that is, under the project node, each group corresponds to a real file system folder. I doubt it is relevant but just in case, I mention it.

Now once I run that pod install, right when it finishes, I believe it either writes to or overwrites the xcworkspace file. And I always know it when i happens, because what happens next is that my left navigation view is totally collapsed. I can't find a picture of it online immediately, but basically picture the above with only "SlideApp" and the Pods project visible.


Solution

  • The user interface state is preserved within you *.xcodeproj->project.workspace->xcuserdata->'user'.xuserdatad->UserInterfaceState.xuserstate

    Where 'user' should be your login I'd.

    If you are so particular about your state then try to backup and install the state after install.

    Your user interface state prior to pod install/update might not be same as after the install as naturally pod install/update causes change in user interface. So the result might not be reproducible.