10
votes

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.

2

2 Answers

11
votes

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;
    };
0
votes

With Xcode Version 12.4--and probably a much earlier version--this information has changed.

When adding attributes for a Core Data entity, the + inserts a new attribute at the top of the list for editing. However, coming back to the entity will show the attributes in alphabetical order.