Change order of .xcdatamodel entries in .xcdatamodeld file
Asked Answered
C

2

11

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.

Calliper answered 29/11, 2011 at 17:21 Comment(0)
H
11

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;
    };
Hesitation answered 28/3, 2012 at 10:28 Comment(2)
Lovely. My universe is slightly more polished in a quiet but satisfying way. :)Wakerly
It helps all of us who have a slight bit (or more) of OCD :SHesitation
M
-1

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.

Milium answered 24/2, 2021 at 19:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.