mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-12 19:41:11 +00:00
Show file name for iOS share extension
This commit is contained in:
1 parent
e808b71446
commit
006f389891
8 files changed
+198
-39
No files matched your search
@@ -22,26 +22,30 @@ class ShareViewController: UIViewController {
|
||||
self?.extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
|
||||
}
|
||||
|
||||
// Replace with your app’s SwiftUI entry view
|
||||
let contentView = ContentView(attachments: attachmentDetails)
|
||||
|
||||
// Embed SwiftUI inside the extension’s controller
|
||||
let hostingController = UIHostingController(rootView: contentView)
|
||||
|
||||
addChild(hostingController)
|
||||
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(hostingController.view)
|
||||
|
||||
// Pin to edges
|
||||
NSLayoutConstraint.activate([
|
||||
hostingController.view.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||
hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor)
|
||||
])
|
||||
|
||||
hostingController.didMove(toParent: self)
|
||||
DispatchQueue.main.async {
|
||||
NearbyConnectionManager.shared.attachments = attachmentDetails
|
||||
}
|
||||
})
|
||||
|
||||
// Replace with your app’s SwiftUI entry view
|
||||
let contentView = ContentView()
|
||||
|
||||
// Embed SwiftUI inside the extension’s controller
|
||||
let hostingController = UIHostingController(rootView: contentView)
|
||||
|
||||
addChild(hostingController)
|
||||
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(hostingController.view)
|
||||
|
||||
// Pin to edges
|
||||
NSLayoutConstraint.activate([
|
||||
hostingController.view.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||
hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor)
|
||||
])
|
||||
|
||||
hostingController.didMove(toParent: self)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user