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

Animate Window Size based on content change #89

Open
davidwernhart opened this issue Dec 16, 2022 · 2 comments
Open

Animate Window Size based on content change #89

davidwernhart opened this issue Dec 16, 2022 · 2 comments

Comments

@davidwernhart
Copy link
Contributor

Is there a possibility to animate the change in window size, when the size of the content changes? Specifically, it would be useful in SwiftUI.

Thank you and kind regards,
David

@DivineDominion
Copy link
Collaborator

DivineDominion commented Dec 31, 2022

@davidwernhart The latest release (v2.6.0) animates transitions when you pass animated: true to the PreferencesWindowController initializer. (Which is the default value.) The Example app in the repo also works for the current main here.

I haven't tried to host SwiftUI views inside, though. Could be the content size isn't available at the correct time?

If you could whip up a 4th pane for the Example app that uses SwiftUI and open a PR, that'd be super helpful 🙏


Edit: I just noticed that Settings.Pane is using a SwiftUI NSHostingController already for macOS 10.15, and that's being used in the example app already.

@davidwernhart
Copy link
Contributor Author

@DivineDominion Hey, thank you for your response! :)

I have looked at the example app and it seems like the "accounts" pane is already implemented in SwiftUI. I have added another demo setting that expands/collapses another section in the same pane. Even though the window does animate when switching panes, it does not when the content size changes. I have created a pull request: #91

Again, thank you for your help and kind regards

sindresorhus added a commit that referenced this issue Jan 23, 2023
Co-authored-by: Sindre Sorhus <[email protected]>
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

2 participants