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

Adds drawHeirarchyInKeyWindow parameter #800

Closed
wants to merge 5 commits into from

Conversation

Jelizondo
Copy link

@Jelizondo Jelizondo commented Nov 1, 2023

What does this Pull Request do?

Adds the drawHeirarchyInKeyWindow parameter to the image method in UIViewController.swift file.

    public static func image(
      on config: ViewImageConfig,
      drawHierarchyInKeyWindow: Bool = false,
      precision: Float = 1,
      perceptualPrecision: Float = 1,
      size: CGSize? = nil,
      traits: UITraitCollection = .init()
    )
      -> Snapshotting
    {

      return SimplySnapshotting.image(
        precision: precision, perceptualPrecision: perceptualPrecision, scale: traits.displayScale
      ).asyncPullback { viewController in
        snapshotView(
          config: size.map { .init(safeArea: config.safeArea, size: $0, traits: config.traits) }
            ?? config,
          drawHierarchyInKeyWindow: drawHierarchyInKeyWindow,
          traits: traits,
          view: viewController.view,
          viewController: viewController
        )
      }
    }

Use case:

Noticed other methods similar to this one had the drawHierarchyInKeyWindow parameter. For our use case we are using UIViewControllers as containers to SwiftUI views that contain UIVisualEffects. Without this parameter the UIVisualEffect would appear transparent in the snapshots.

Is this something we can add? Thanks!

@Jelizondo
Copy link
Author

Closed in favor of #801!

@Jelizondo Jelizondo closed this Nov 2, 2023
@Jelizondo Jelizondo deleted the drawHierarchyInKeyWindow branch November 2, 2023 03:22
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.

2 participants