3
Text("Hello, world!")
            .textSelection(.enabled)
            .padding()

Whan i press the "Hello, world!" and select the copy, it nerver copy any thing

1 Answers1

1

This appears to be an iOS bug. I got the same issue on an iOS 15.2.1 device but not on iOS 16 simulator. A workaround:

Text($someText)
.contextMenu(ContextMenu(menuItems: {
  Button("Copy", action: {
    UIPasteboard.general.string = someText
  })
}))

from https://stackoverflow.com/a/66903216

Daniel
  • 1,101
  • 9
  • 18