Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change order of .xcdatamodel entries in .xcdatamodeld file

I have several Core Data model version that I have added to my .xcdatamodeld file, and this last version that I added did not show up at the top of the list as it normally does, it is the 2nd item in the list under the .xcdatamodeld file. I set the latest version as the current versioned Core Data model, but I cannot reorder the .xcdatamodel entries by dragging them around, so is there any way that I can change the order of the entries so that the newest version shows up at the top?

By the way, I am on Xcode 4.2 build 4C199 for Snow Leopard.

like image 999
BP. Avatar asked Nov 29 '11 17:11

BP.


1 Answers

Yeah, this part is totally annoying - but it's not too hard. I do it all the time. You have to edit the MyProject.xcodeproj/project.pbxproj file yourself with a text editor (I use vim for this), and look for where your list of models are, then just re-order the children section, like this:

    D6A5760112F22213004DEDCE /* Scott.xcdatamodeld */ = {
        isa = XCVersionGroup;
        children = (
            D6B7528A1506A0050066268A /* Scott-V14.xcdatamodel */,
            D659922515057BC100955005 /* Scott-V13.xcdatamodel */,
            D6EDB44614ED9D7E00C02938 /* Scott-V12.xcdatamodel */,
            D6931E6214D78135007F0E03 /* Scott-V11.xcdatamodel */,
        );
        currentVersion = D6B7528A1506A0050066268A /* Scott-V14.xcdatamodel */;
        name = Scott.xcdatamodeld;
        path = Shared/Scott.xcdatamodeld;
        sourceTree = "<group>";
        versionGroupType = wrapper.xcdatamodel;
    };
like image 148
Scott Corscadden Avatar answered Sep 28 '22 01:09

Scott Corscadden