Skip to content

Instantly share code, notes, and snippets.

@mazz
Created November 3, 2018 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mazz/986a0b12b4a953ed3f505b7fa1e63dfb to your computer and use it in GitHub Desktop.
Save mazz/986a0b12b4a953ed3f505b7fa1e63dfb to your computer and use it in GitHub Desktop.
// setup sharing button and UIActivityViewController
// once the download finishes
downloadingViewModel.fileDownloadCompleteEvent.asObservable()
.observeOn(MainScheduler.instance)
.subscribe({ download in
self.fullDownloadButton.rx.tap
.bind {
// copy file to temp dir to rename it
if let localDownload = self.downloadingViewModel.fileDownload.value {
let activityViewController = UIActivityViewController(activityItems: [UIImage(named: "FWBCLogo")!, "Shared via the Faithful Word App: https://faithfulwordapp.com/", localDownload.localUrl], applicationActivities: nil)
activityViewController.excludedActivityTypes = [
.addToReadingList,
.openInIBooks,
.print,
.saveToCameraRoll,
.postToWeibo,
.postToFlickr,
.postToVimeo,
.postToTencentWeibo]
self.present(activityViewController, animated: true, completion: {})
}
}
})
.disposed(by: bag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment