DeckKit icon indicating copy to clipboard operation
DeckKit copied to clipboard

Questions about sharing

Open sy1995 opened this issue 3 years ago • 1 comments

How is the sharing effect in the example picture realized? Is there any relevant code?

thx!

sy1995 avatar Nov 24 '21 07:11 sy1995

Hi! The sharing is done by first taking a snapshot if the view, then sharing it with a share sheet.

I think the demo app has this functionality built in, otherwise you can find both the View+Snapshot extension and the ShareSheet implementation in my SwiftUIKit library:

https://github.com/danielsaidi/SwiftUIKit

danielsaidi avatar Nov 24 '21 15:11 danielsaidi

Hi again,

Closing this due to inactivity.

Just wanted to add that SwiftUI 4 now contains an ImageRenderer that can be used to take snapshots of views. If your app supports older iOS versions, you can find a backported version in SwiftUIKit:

https://github.com/danielsaidi/SwiftUIKit

danielsaidi avatar Aug 20 '22 09:08 danielsaidi