If you are loading the site into WKWebview you can inject anything you want into the site. You can definitely make a bridge to talk back and forth. Swift <> JavaScript.

Be cautious, apple is very weird about doing this.