Post

Replies

Boosts

Views

Activity

Reply to Updated code for Sharesheet in iOS 15?
with SwiftUI you must implement an UIViewControllerRepresentable in order to load a UIKit. struct ActivityViewController: UIViewControllerRepresentable { var itemsToShare: [Any] var servicesToShareItem: [UIActivity]? = nil func makeUIViewController(context: UIViewControllerRepresentableContext<ActivityViewController>) -> UIActivityViewController { let controller = UIActivityViewController(activityItems: itemsToShare, applicationActivities: servicesToShareItem) return controller } func updateUIViewController(_ uiViewController: UIActivityViewController, context: UIViewControllerRepresentableContext<ActivityViewController>) {} } and then on your view you should implement a .sheet to load this UIActivityViewController. YourView() .sheet(isPresented: $showShareSheet, content: { ActivityViewController(itemsToShare: [YourDataHereToShare]) }) the shareSheet is not perfect yet, I'm still figuring out too. hence why I'm here too :)
Dec ’21