ShareView
ShareView
is a SwiftUI wrapper for
UIActivityViewController
that enables external sharing
capabilities. This wrapper carries over success, failure and destination
metadata through the
UIActivityViewController.CompletionWithItemsHandler
, which
is not available in the SwiftUI native ShareLink
as of iOS
17.
Usage
(
ShareView: [
shareableItems.Image(
Shareable: {
imagelet renderer = ImageRenderer(
: Rectangle()
content.fill(.orange)
.frame(width: 100, height: 100)
)
return renderer.uiImage!
}(),
: "Test Image"
title)
]
)
.ignoresSafeArea()
.presentationDetents([.medium, .large])
Features
- Supports external image sharing by passing Shareable.Image.
- Supports external video sharing by passing Shareable.Video.
- Supports usage in SwiftUI Previews for easy debugging and testing.