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

Use custom presentation animator #139

Conversation

SergeyKuryanov
Copy link
Contributor

@SergeyKuryanov SergeyKuryanov commented Oct 5, 2019

This PR is attempt to Fixes #108

Custom animator was added and used.

Unfortunately app crashes when you try to dismiss controller presented with present(_, animator:). I assume this is because window.contentViewController` being replaced.


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

@sindresorhus
Copy link
Owner

The benefit of using present is that it's possible to dismiss the view controller to go back to the previous one. For example, when the user cancels the editing, we could just dismiss that view controller.

The point of #108 is to not replace, but to push into the view controller stack.

@SergeyKuryanov
Copy link
Contributor Author

@sindresorhus may you please clarify what you mean by push into the view controller stack? I have little experience with MacOs dev, but as far as I know there is no controllers stack (like on iOS). We can try layer views on top to simulate this, or you mean something different?

@sindresorhus
Copy link
Owner

While I haven't done this before, I think it's possible. Instead of replacing window.contentViewController each time, we give that view controller the responsibility of presenting and dismissing other view controllers.

https://developer.apple.com/documentation/appkit/nsviewcontroller/1434497-presentedviewcontrollers
https://developer.apple.com/documentation/appkit/nsviewcontroller/1434447-dismiss

@SergeyKuryanov
Copy link
Contributor Author

FYI: PR is not abandoned, just looking for solution.

@sindresorhus
Copy link
Owner

Friendly bump :)

@sindresorhus
Copy link
Owner

Closing as this is not moving forward. Open a new PR if you ever get to this ;)

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.

Use NSViewController.present() with custom animator
2 participants