How are we supposed to use the new Clipboard APIs ...
# compose
s
How are we supposed to use the new Clipboard APIs in Compose 1.8? I feel somewhat dumb but I can't really figure it out. There's a single clear function to use:
Clipboard.setClipEntry
, but I can't figure out how to create a
ClipEntry
, I get
Expected class 'expect class ClipEntry : Any' does not have default constructor.
, and there seems to be no factory or companion functions to use (at least not from
commonMain
). My usage with the deprecated APIs was this:
clipboard.setText(AnnotatedString(text))
, any help would be appreciated.
plus one 3
k
Can you use
ClipData.toClipEntry()
function?
s
I think that's Android-only? This is a multiplatform project, and it'd be great if there's a simple cross-platform way of copying text at least from common code, like the old API.
There's an issue for adding a common way to create a
ClipEntry
for the new Clipboard APIs, make sure to upvote it! https://youtrack.jetbrains.com/issue/CMP-7624
2
153 Views