mirror of
https://github.com/yattee/yattee.git
synced 2024-12-15 14:50:32 +05:30
29 lines
955 B
Swift
29 lines
955 B
Swift
import Foundation
|
|
import SwiftUI
|
|
|
|
struct ShareSheet: UIViewControllerRepresentable {
|
|
typealias Callback = (_ activityType: UIActivity.ActivityType?,
|
|
_ completed: Bool,
|
|
_ returnedItems: [Any]?,
|
|
_ error: Error?) -> Void
|
|
|
|
let activityItems: [Any]
|
|
let applicationActivities = [UIActivity]()
|
|
let excludedActivityTypes = [UIActivity.ActivityType]()
|
|
let callback: Callback? = nil
|
|
|
|
func makeUIViewController(context _: Context) -> UIActivityViewController {
|
|
let controller = UIActivityViewController(
|
|
activityItems: activityItems,
|
|
applicationActivities: applicationActivities
|
|
)
|
|
|
|
controller.excludedActivityTypes = excludedActivityTypes
|
|
controller.completionWithItemsHandler = callback
|
|
|
|
return controller
|
|
}
|
|
|
|
func updateUIViewController(_: UIActivityViewController, context _: Context) {}
|
|
}
|