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

WhistleFactory whistleWindow not removed after display? #221

Open
JCsplash opened this issue Jun 9, 2021 · 0 comments
Open

WhistleFactory whistleWindow not removed after display? #221

JCsplash opened this issue Jun 9, 2021 · 0 comments

Comments

@JCsplash
Copy link

JCsplash commented Jun 9, 2021

Is there a reason why the whistleWindow is not removed after displaying? It's causing issues in my code whenever I call UIApplication.shared.windows.first, which returns the whistleWindow and not the expected keyWindow.

I forked the project and made whistleWindow an optional and I set it to nil when the display has finished.

public func hide() {
    let finalOrigin = view.frame.origin.y - titleLabelHeight - Dimensions.notchHeight
    UIView.animate(withDuration: 0.2, animations: {
      self.whistleWindow?.frame.origin.y = finalOrigin
      }, completion: { _ in
        if let window = self.previousKeyWindow {
          window.isHidden = false
          self.whistleWindow = nil // Setting this to nil... Will this cause any problems?
          self.previousKeyWindow = nil
          window.rootViewController?.setNeedsStatusBarAppearanceUpdate()
        }
    })
  }

Will this solution cause any problems?

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