WKWebView WarmUp

Swift Platforms

Swifth Package Manager Cocoapods

Swift CI Swift Docs

Latest release

A library that speeds up the loading of Web Pages when using WKWebView.


Platform Minimun Swift Version Installation Status
iOS 9.0+ 5.3 Cocoapods, Swift Package Manager Fully Tested
macOS 10.10+ 5.3 Cocoapods, Swift Package Manager Fully Tested



pod 'WKWebView_WarmUp', '~> <latest version>'

Swift Package Manager

// Inside Package definition
dependencies: [
    .package(url: "https://github.com/eaceto/WKWebView_WarmUp.git", .upToNextMajor(from: "<latest version>"))

// Inside Target definition
dependencies: [


When you want to speed up the loading of a WebView, perform the following request with the required URL / URLRequest to load.

let url = URL(string: "https://duckduckgo.com")!
WKWebViewHeater.shared.warmUp(with: url)

This call should be done as soon as possible, and before your app makes all the critical calls, so the calls performed by the WKWebViewHeater.

Then, when you want to retrieve the warmed-up WebView, just call

let webView = WKWebViewHeater.shared.dequeue(with: url)!

Remember that this WebView’s size is Zero! In order to added to your ViewController, use AutoLayout as follows:

// Declare a variable that holds the WebView
private lazy var webView: WKWebView = {
    let webView: WKWebView!
    webView = WKWebViewHeater.shared.dequeue(url: urlString)
    // Set other properties of the WebView
    webView.configuration.allowsInlineMediaPlayback = true
    webView.translatesAutoresizingMaskIntoConstraints = false
    webView.scrollView.alwaysBounceHorizontal = false
    return webView

override func viewDidLoad() {

    // Add the WebView

    // Set WebView's delegate and props
    webView.navigationDelegate = self
    // User AutoLayout to set its constraints
    let webViewConstraints = [
        webView.topAnchor.constraint(equalTo: view.topAnchor),
        webView.leftAnchor.constraint(equalTo: view.leftAnchor),
        webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
        webView.rightAnchor.constraint(equalTo: view.rightAnchor)


© 2020 Ezequiel (Kimi) Aceto

This project is distributed under MIT License.


View Github