// // ActivityViewController.swift // LiTranslate // // Created by Viktor Kalyniuk on 18.08.2022. // import SwiftUI struct ActivityViewController: UIViewControllerRepresentable { var activityItems: [Any] var applicationActivities: [UIActivity]? = nil @Environment(\.presentationMode) var presentationMode func makeUIViewController(context: UIViewControllerRepresentableContext) -> UIActivityViewController { let controller = UIActivityViewController(activityItems: activityItems, applicationActivities: applicationActivities) controller.completionWithItemsHandler = { (activityType, completed, returnedItems, error) in self.presentationMode.wrappedValue.dismiss() } return controller } func updateUIViewController(_ uiViewController: UIActivityViewController, context: UIViewControllerRepresentableContext) { } }