SwiftEntryKit icon indicating copy to clipboard operation
SwiftEntryKit copied to clipboard

Edit Menu appears behind Swift Entry Kit when selecting text

Open aheze opened this issue 4 years ago • 3 comments

So when I select text (in a WKWebView, but I've also seen this happen with normal UITextViews), the Edit Menu popup appears behind the View Controller that I've presented with Swift Entry Kit.

To Reproduce Steps to reproduce the behavior:

  1. Present custom view controller
  2. Select text in UITextView/WKWebView
  3. See error

Here's a screenshot:

The Edit menu appears in the back....

aheze avatar Mar 27 '20 03:03 aheze

same issue....

MichaelHuyp avatar Feb 20 '21 10:02 MichaelHuyp

@MichaelHuyp I ended up just presenting this normally, with present(_:animated:completion:).

aheze avatar Feb 26 '21 21:02 aheze

@aheze

/**
     Displays a given entry view using an attributes struct.
     - A thread-safe method - Can be invokes from any thread
     - A class method - Should be called on the class
     - parameter view: Custom view that is to be displayed
     - parameter attributes: Display properties
     - parameter presentInsideKeyWindow: Indicates whether the entry window should become the key window.
     - parameter rollbackWindow: After the entry has been dismissed, SwiftEntryKit rolls back to the given window. By default it is *.main* which is the app main window
     */
    public class func display(entry view: UIView, using attributes: EKAttributes, presentInsideKeyWindow: Bool = false, rollbackWindow: RollbackWindow = .main) {
        DispatchQueue.main.async {
            EKWindowProvider.shared.display(view: view, using: attributes, presentInsideKeyWindow: presentInsideKeyWindow, rollbackWindow: rollbackWindow)
        }
    }

RollbackWindow Appointed as keywindow Fixed this problem

MichaelHuyp avatar Mar 01 '21 03:03 MichaelHuyp