Change item order in plist file
Asked Answered
H

2

10

I want to change order in plist file not programmatically but from xcode. Is there a way in Xcode where i can sort by value? I simply want to arrange it for myself. For now if i want add new item it will always goes to tail.

Like here

How to sort it ? To 100 value go to the top?

Hagioscope answered 27/6, 2012 at 11:13 Comment(0)
Q
6

Your can edit a plist file with an text editor. Right click on plist file -> open as -> source code.

and i think you have to put you strings in an Array

Quetzal answered 27/6, 2012 at 11:26 Comment(1)
Thanks, but this is also kind of programmatically solution. There is no way to do this by click-and-sort?Hagioscope
D
19

Here is the (mildly infuriating) answer, at least in the case of Items in a Settings.bundle's plist, which I realize was not the OP's situation.

To arbitrarily reorder items in a plist:

  1. Target the row by clicking within the Value column. The left-most columns don't allow dragging.
  2. Drag into the first ~64 pixels of the Key column. A blue line appears to indicate where the row will appear when you let go.

Here's a demonstration in Xcode 9.2.

enter image description here

As if that's not already super confusing…

Preference Items, Vertical Drag

You can drag and drop vertically (i.e., without entering the Key column), but only if your goal is to move the item to be first in the list.

enter image description here

Apple Clearly Knows How to Do This

Once you open an Item, elements within it can be dragged and dropped exactly as you'd expect.

enter image description here

Wat!? Yeah. This doesn't need to be so painful, but it's likely to remain this way unless folks get up in arms which, once you know the workaround, it's hard to do. But in case you're feeling sufficiently incensed, make your voice heard: http://bugreporter.apple.com. (Fwiw, here's my Open Radar.)

Dielectric answered 19/4, 2018 at 23:3 Comment(1)
Thank you for this excellent answer, and also for raising the issue with Apple!Rrhoea
Q
6

Your can edit a plist file with an text editor. Right click on plist file -> open as -> source code.

and i think you have to put you strings in an Array

Quetzal answered 27/6, 2012 at 11:26 Comment(1)
Thanks, but this is also kind of programmatically solution. There is no way to do this by click-and-sort?Hagioscope

© 2022 - 2024 — McMap. All rights reserved.