我正在使用 share sheet 打开一些本地应用程序-即邮件,提醒,笔记,消息。是我的代码在单击共享按钮后打开共享表。
我正在寻找一种方法来识别用户点击共享表,即当用户选择共享表上的选项时调用的 API。我搜索并找不到任何东西,所以不确定是否有一种方法来识别用户选择?
func presentShareSheet(content: String, subject: String = "", shareButton: UIView? = nil, presentingVC: UIViewController? = nil) -> Guarantee<Void> {
return Guarantee { seal in
let itemsToShare: [Any] = [someItems]
let activityViewController = UIActivityViewController(activityItems: itemsToShare, applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = shareButton
activityViewController.completionWithItemsHandler = { activityType, completed, items, error in
// update color of navigation bar
seal(())
}
if let vc = presentingVC ?? UIApplication.shared.topMostViewController() {
vc.present(activityViewController, animated: true)
} else {
seal(())
}
}
}
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(72条)