-
|
I'm trying to implement a simple drag and drop feature. KFImage(imageUrl)
.onDrag {
NSItemProvider(contentsOf: imageUrl) ?? NSItemProvider()
}There is the Any help is appreciated 😄 |
Beta Was this translation helpful? Give feedback.
Answered by
onevcat
Jul 7, 2022
Replies: 1 comment 1 reply
-
|
There is an image object in the var image: KFCrossPlatformImage?
struct ContentView : View {
KFImage(url)
.onSuccess { r in
image = r.image
}
.onDrag({
if let i = image {
return .init(object: i)
} else {
return .init(contentsOf: url) ?? .init()
}
})
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
axiel7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is an image object in the
onSuccesscallback, maybe you can try to store that and create anNSItemProvider. Some sample snippets: