I'm making a very simple app for a demo and am trying to present a webpage using SFSafariViewController
(I need to use SF
versus WKWebView
so to be able to access cookies).
I would really like to present the User
with some UI buttons
, but I've been unable to pull it off.
I tried this snippet (placed in the completion callback of presentViewController()
:
let width: CGFloat = 66
let x: CGFloat = self.view.frame.width - width
// It can be any overlay. May be your logo image here inside an imageView.
let overlay = UIView(frame: CGRect(x: x, y: 20, width: width, height: 44))
overlay.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.5)
svc.view.addSubview(overlay)
... outlined in this post. In their case, they're attempting to cover the reload button with a small view. Regardless of the use-case, for me the view immediately disappears when I load SFSafariViewController
(I can see it for a moment and it disappears).
I was thinking about presenting the button in an .OverContext
modal, but then the User would be unable to interact with the SFSafariViewController
, which also doesn't work.
Here's essentially what I'm after (pardon the gross, quick mockup) ... basically, SafariViewController with a view presented over it (see bottom) ... the transparency is just to show that it's being presented over Safari).
Any recommendations are greatly appreciated.