Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the default scheme for a workspace in Xcode?

Tags:

xcode

I have a workspace in Xcode with about 10 schemes.

Whenever I clone the repository and open the Xcode workspace from a freshly cloned repository for the first time, the scheme that is selected is always the first scheme that I created when I first developed the Xcode workspace. Since then, I have added about 9 additional schemes.

I would like the default scheme that is selected when the Xcode project is first opened from a freshly cloned repository to be a different scheme.

Note that Set the default scheme for Xcode project does not answer this question, despite the promising title. I cannot find this question asked, or answered, anywhere else.

How is it possible to set the default scheme in an Xcode project?

like image 837
Dan Nissenbaum Avatar asked Jul 12 '13 21:07

Dan Nissenbaum


1 Answers

I dug into this and found at least part of an answer. Hopefully this helps. I am not working with a workspace, but I am working with a project with multiple subprojects and schemes.

The selected scheme for the project appears to be a user-specific configuration, and it does not appear to be shareable to a new user that clones the repository. I can tell from watching my git repo after changing the setting that the information is stored in

<projectname>.xcodeproj/project.xcworkspace/xcuserdata/<username>.xcuserdatad/UserInterfaceState.xcuserstate

So then, if we can't set the selected scheme, can we set the order such that the desired scheme shows up at the top? It seems like no since, even for shared schemes, the scheme order information is placed in a user-specific file:

<projectname>.xcodeproj/xcuserdata/<username>.xcuserdatad/xcschemes/xcschememanagement.plist

This was as much as I could figure out, but I believe that there must be a way, even if it's a bit of a hack. The project saves the order that you created the schemes somehow, probably in the project.pbxproj file. So perhaps a little cut-and-paste rearrangement of that file could yield some results.

like image 195
user1021430 Avatar answered Oct 22 '22 15:10

user1021430