yattee/iOS/ShareSheet.swift
Toni Förster 94577332a1
chore: address linter warnings
Signed-off-by: Toni Förster <toni.foerster@gmail.com>
2024-08-18 14:46:51 +02:00

32 lines
1.1 KiB
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 = { activityType, completed, returnedItems, error in
callback?(activityType, completed, returnedItems ?? [], error)
}
return controller
}
func updateUIViewController(_: UIActivityViewController, context _: Context) {}
}