-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PR] Support to export overlay view #54
Conversation
…illImageHeatmapViewController
let image = view.uiImage(in: rect) | ||
let imageData = image.jpegData(compressionQuality: 0.95) | ||
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) | ||
let fileURL = paths[0].appendingPathComponent("pose-heatmap-demo.jpeg") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is better using first
than accessing with index. if first element is empty, it will be crashed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ops. I accept your suggestion. Thanks. 👍
let fileURL = paths[0].appendingPathComponent("pose-linedot-demo.jpeg") | ||
try? imageData?.write(to: fileURL) | ||
let vc = UIActivityViewController(activityItems: [fileURL], applicationActivities: nil) | ||
present(vc, animated: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, export has 2 tasks.
- export Image.
- show UIActivityViewController.
I recommend to make 2 abstract task(exportImage, showUIActivityViewController).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@syjdev
Thanks for your opinion.
I think the above function has exporting behavior in the app term. So I'll separate the export(_:)
function to saving the image step and show UIActivityViewController
step. If you have any other comments, reply feel free.
Thank you.
Cautions
Related Issue
PR Point