Skip to content
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

Merged
merged 3 commits into from
May 9, 2020
Merged

Conversation

tucan9389
Copy link
Owner

@tucan9389 tucan9389 commented May 5, 2020

Cautions

Related Issue

PR Point

@tucan9389 tucan9389 self-assigned this May 5, 2020
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")
Copy link

@MBKwon MBKwon May 5, 2020

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.

Copy link
Owner Author

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)
Copy link
Collaborator

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.

  1. export Image.
  2. show UIActivityViewController.

I recommend to make 2 abstract task(exportImage, showUIActivityViewController).

Copy link
Owner Author

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.

@tucan9389 tucan9389 merged commit 1393930 into param-ui May 9, 2020
@tucan9389 tucan9389 deleted the export-overlayview-image branch May 9, 2020 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants