morizotter / TouchVisualizer

Lightweight touch visualization library in Swift. A single line of code and visualize your touches!
MIT License
864 stars 110 forks source link

Display touches in a SFSafariViewController #82

Open davidgeilfus opened 6 years ago

davidgeilfus commented 6 years ago

Hi, how can I display touches in a SFSafariViewController that is presented programmatically from another view controller? Here is my current code:

let svc = SFSafariViewController(url: NSURL(string: self.urlString)! as URL)

svc.delegate = self
present(svc, animated: true, completion: {
    Visualizer.start()
})

I also tried to start the Visualizer within a SFSafariViewControllerDelegate event handler:

func safariViewController(_ controller: SFSafariViewController, didCompleteInitialLoad didLoadSuccessfully: Bool) {
    Visualizer.start()
}

… But in any case, touches aren't displayed. Any idea why? Thanks!

davidgeilfus commented 6 years ago

I moved the call to Visualizer.start() to the AppDelegate and touches are visualized just fine… Until the SFSafariViewController is presented. When going back to the initial view controller, touches aren't displayed anymore.

morizotter commented 6 years ago

Mmm.. Thanks for reporting that.

Basically Visualizer is displayed on the active window, so I guess When SFSafariViewController shows, the window may change...