I've ended up using this workaround successfully, basically you load a local page that redirects to your actual page. For some reason this makes the service worker always work and the page load off-line from the start.
let html = """<html><head><meta http-equiv="Refresh" content="0; url='\(YOUR_URL_HERE)'" /></head><body></body></html>""" webView.loadHTMLString(html, baseURL: nil)
Topic:
Safari & Web
SubTopic:
General
Tags: