Follow

I'm stumped on how to add an undo keyboard shortcut on iPad. I'm using the environment's UndoManager. On the Mac, Undo appears in the Edit menu and "just works”.

I tried adding my own button, but UIKit throws a messaging saying it's duplicate, so I assume there is one but it's hidden?

Any ideas would be very much appreciated!

@phill Is the duplicate message because the standard iPad keyboard includes undo/redo buttons?

@marksmith yeah I wondered that too, but even without a keyboard presented/connected it still complains. I thought maybe TextEditingCommands() was adding some, but it doesn’t look like it. Perplexing!

@phill perhaps this is similar to ToolbarItems where they don’t share the environment. “Commands” is not “View” and doesn’t get the environment so you need to pass values in as properties. If you add a property for the UndoManager and pass the value in from a parent View when using it I think it will work.

@ryanlintott yeah that part is okay (I set it with the focussed value), the issue is the keyboard shortcut itself has already been taken by the system, but there seems to be no way to access it ☹️

Sign in to participate in the conversation
The Not So Big Company

The home of The Not So Big Company on Mastodon.