Skip to content

Conversation

@stotic-dev
Copy link
Contributor

@stotic-dev stotic-dev commented Dec 20, 2025

Short description 📝

Describe here the purpose of your PR.

To get a snapshot of a Liquid Glass component, you need to modify the template and set drawHierarchyInKeyWindow to true as mentioned in #136. However, this is a bit of a hassle, so we've made it possible to set drawHierarchyInKeyWindow to true as an optional setting in prefire.yaml.

Solution 📦

Describe the solution you came up with and the reasons that led you to that solution. If you thought about other solutions don't forget about mentioning them.

The use case we wanted to solve was making it easy to obtain Liquid Glass components. Because Liquid Glass affects the entire app, we determined that there was no setting to switch drawHierarchyInKeyWindow for each Preview. Therefore, our current solution makes it possible to specify a common setting for drawHierarchyInKeyWindow for all Previews.

If there are some use cases where you want to set drawHierarchyInKeyWindow to false, we believe that a separate solution would be to make it possible to specify drawHierarchyInKeyWindow with the snapshot modifier.

Implementation 👩‍💻👨‍💻

Detail in a checklist the steps that you took to implement the PR.

  • Modify the test_configuration in Example/.prefire.yml as follows:
    • Set required_os to 26
    • Add draw_hierarchy_in_key_window_default_enabled: true
  • Add the following Preview under Example/Shared/Examples
#Preview("LiquidGlass") {
    NavigationStack {
        Text("Liquid Glass View")
            .toolbar {
                ToolbarItem(placement: .topBarTrailing) {
                    Button {} label: {
                        Image(systemName: "plus")
                    }
                }
            }
    }
}
  • Run the PrefireExampleTests test and confirm that the LiquidGlass snapshot has the LiquidGlass effect as shown below.
image

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.

1 participant