2

In an iOS shortcut I can ask the user to select an item from a list, but how do I access the selected index?

I need that in order to get at the selected object in the case where I’ve already converted the objects into more presentable text for the action sheet.

Update:

What I really wanted was to customise the user-facing string representation of an item.

2
  • @fsb It was I who made the edits to the answer without being logged in, in order to make it more clear to future readers which problem the answer solves, and what the intended result of it will be.
    – Andreas
    Oct 11 '20 at 22:04
  • Andreas - just go ahead and post the clearest answer you wish to have or wait for the lock to expire before trying another edit on the locked answer..
    – bmike
    Oct 11 '20 at 23:34
3

Based on the comments, this Apple Support site held the answer. Use "Set Name" to get the value:

To set a custom name for an item that an action outputs, such as an image in the Get Latest Photos action, place a Set Name action in between the Get Latest Photos action and the Choose from List action. When the shortcut is run, the custom name (rather than the default name, such as “IMG_0365”) is applied to the image output from the Get Latest Photos action.

If you use the Choose from List action with the Dictionary action, all of the keys in the dictionary are displayed when you tap “Add new item.” For each key you select, such as Number, Boolean, or Array, the corresponding values are passed as output.

1
  • Thanks @fsb for the correction. If the OP needs different wording, perhaps they can post their best answer and select it instead.
    – bmike
    Oct 11 '20 at 21:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .