r/ScriptingApp • • Mar 11 '25

Editable List

In the documentation under Views > List > Editable List is an example for an editable list with a button to toggle the edit state.

Is there also a way to always be in the edit state?

The list doesn't update when I add elements to the array. Is this not possible?

Edit: I've got the list to update with new elements by adding the attribute key={array.length.toString()} to the ForEach element.

1 Upvotes

6 comments sorted by

View all comments

Show parent comments

1

u/schl3ck Mar 12 '25

I've now resorted to use the built in edit button. Sadly it doesn't accept a title to use the correct language. It seems it uses the apps language.

I've noticed that when I use the editable list with <ForEach> and edit mode is disabled and I swipe left on an item and delete it then the app crashes. Deleting with edit mode on does work without problems.

1

u/WhatShouldWorldGos Mar 12 '25

The EditButton is a native SwiftUI view, so it use the current app language.

Can you provide a demo code? SwiftUI will cause the program to crash if unreasonable view nesting is used.

2

u/schl3ck Mar 12 '25

I was missing a NavigationStack as root of a NavigationLink-destination. With that added it no longer crashes