mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Implement basic share feature
This commit is contained in:
parent
9e291af377
commit
eb83b0418c
@ -152,6 +152,15 @@ struct PostEditorView: View {
|
||||
self.hideKeyboard()
|
||||
#endif
|
||||
}
|
||||
|
||||
private func sharePost() {
|
||||
guard let urlString = model.selectedPost?.slug != nil ?
|
||||
"\(model.account.server)/\((model.selectedPost?.collectionAlias)!)/\((model.selectedPost?.slug)!)" :
|
||||
"\(model.account.server)/\((model.selectedPost?.postId)!)" else { return }
|
||||
guard let data = URL(string: urlString) else { return }
|
||||
let activityView = UIActivityViewController(activityItems: [data], applicationActivities: nil)
|
||||
UIApplication.shared.windows.first?.rootViewController?.present(activityView, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
struct PostEditorView_EmptyPostPreviews: PreviewProvider {
|
||||
|
Loading…
Reference in New Issue
Block a user