//
//  ActivityViewController.swift
//  SodaLive
//
//  Created by klaus on 2023/08/11.
//

import SwiftUI

struct ActivityViewController: UIViewControllerRepresentable {
    var activityItems: [Any]
    var applicationActivities: [UIActivity]? = nil
    @Environment(\.presentationMode) var presentationMode
    
    func makeUIViewController(context: Context) -> some UIActivityViewController {
        let controller = UIActivityViewController(
              activityItems: activityItems,
              applicationActivities: applicationActivities
            )
            controller.completionWithItemsHandler = { (activityType, completed, returnedItems, error) in
              self.presentationMode.wrappedValue.dismiss()
            }
            return controller
    }
    
    func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {
    }
}
