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

Question: How to make a screenshot of a CalendarViewRepresentable? #303

Open
streem-ua opened this issue May 3, 2024 · 0 comments
Open

Comments

@streem-ua
Copy link

Hello guys! Have an issue here, need help or advice.
I'm building a calendar view and want to be able to share this view to instagram.

Screenshot 2024-05-03 at 19 00 53

Pressing on blue button at the bottom I want to copy this view to the UIPasteboard.general.image.
I'm trying to it it via ImageRenderer, like so:

    func snapshot() {
        let imagerenderer = ImageRenderer(
            content: myCalendarView.frame(maxWidth: 100, maxHeight: 100)
        )
        guard let image = imagerenderer.uiImage else { return }
        UIPasteboard.general.image = image
    }

But I receive an error:

HorizonCalendar/CalendarViewProxy.swift:85: Fatal error: Attempted to use an existing `CalendarViewProxy` instance with a new `CalendarViewRepresentable`.
Screenshot 2024-05-03 at 19 03 04

Can you please tell me what can I do in this situation?

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

No branches or pull requests

1 participant