{"id":17650730,"url":"https://github.com/eaceto/wkwebview_warmup","last_synced_at":"2025-09-04T07:06:15.812Z","repository":{"id":38246355,"uuid":"486168805","full_name":"eaceto/WKWebView_WarmUp","owner":"eaceto","description":"A library that speeds up the loading of Web Pages when using WKWebView","archived":false,"fork":false,"pushed_at":"2023-01-30T16:14:55.000Z","size":363,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T07:06:41.583Z","etag":null,"topics":["ios","macos","uiwebview","webview","webview-library","wkwebview"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eaceto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-27T11:43:48.000Z","updated_at":"2023-07-12T07:16:40.000Z","dependencies_parsed_at":"2023-02-16T09:15:52.865Z","dependency_job_id":null,"html_url":"https://github.com/eaceto/WKWebView_WarmUp","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eaceto%2FWKWebView_WarmUp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eaceto%2FWKWebView_WarmUp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eaceto%2FWKWebView_WarmUp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eaceto%2FWKWebView_WarmUp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eaceto","download_url":"https://codeload.github.com/eaceto/WKWebView_WarmUp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252831256,"owners_count":21810783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","macos","uiwebview","webview","webview-library","wkwebview"],"created_at":"2024-10-23T11:39:20.827Z","updated_at":"2025-05-07T07:07:02.320Z","avatar_url":"https://github.com/eaceto.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WKWebView WarmUp\n\n![Swift](https://img.shields.io/badge/Swift-5.3_5.4_5.5_5.6-yellowgreen?style=flat-square)\n![Platforms](https://img.shields.io/badge/Platforms-macOS_iOS-yellowgreen?label=Platforms\u0026style=flat-square)\n\n![Swifth Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)\n![Cocoapods](https://img.shields.io/cocoapods/v/WKWebView_WarmUp?label=Cocoapods\u0026style=flat-square)\n\n[![Swift CI](https://github.com/eaceto/WKWebView_WarmUp/actions/workflows/swift-ci.yml/badge.svg)](https://github.com/eaceto/WKWebView_WarmUp/actions/workflows/swift-ci.yml)\n[![Swift Docs](https://github.com/eaceto/WKWebView_WarmUp/actions/workflows/swift-docs.yml/badge.svg?branch=main)](https://github.com/eaceto/WKWebView_WarmUp/actions/workflows/swift-docs.yml)\n\n[![Latest release](https://img.shields.io/badge/Latest_release-1.1.0-blue.svg)](https://github.com/eaceto/WKWebView/releases/1.1.0)\n\nA library that speeds up the loading of Web Pages when using WKWebView.\n\n## Table of Contents\n\n1. References\n    * [GitHub Page](https://eaceto.github.io/WKWebView_WarmUp/)\n    * [Code Documentation](./code/jazzy/index.html)\n    * [Coverage Report](./coverage/index.html)\n    * [Lint report](./code/swiftlint/index.html)\n    * [Code Analysis](https://app.snyk.io/org/eaceto/project/9749d95d-30cd-4e89-af98-b57bdc22d8c7)\n2. [Requirements](#requirements)\n3. [Installation](#installation)\n    * [Cocoapods](#cocoapods)\n    * [Swift Package Manager](#swift-package-manager)\n4. [Usage](#usage)\n5. [Notes](#notes)\n6. [Author](#author)\n\n### Requirements\n\n| Platform | Minimun Swift Version | Installation | Status |\n| --- | --- | --- | --- |\n| iOS 9.0+ | 5.3 | [Cocoapods](#cocoapods), [Swift Package Manager](#swift-package-manager) | Fully Tested |\n| macOS 10.12+ | 5.3 | [Cocoapods](#cocoapods), [Swift Package Manager](#swift-package-manager) | Fully Tested |\n\n### Installation\n#### Cocoapods\n\n````ruby\npod 'WKWebView_WarmUp', '~\u003e \u003clatest version\u003e'\n````\n\n#### Swift Package Manager\n\n````swift\n// Inside Package definition\ndependencies: [\n    .package(url: \"https://github.com/eaceto/WKWebView_WarmUp.git\", .upToNextMajor(from: \"\u003clatest version\u003e\"))\n]\n\n// Inside Target definition\ndependencies: [\n    \"WKWebView_WarmUp\"\n]\n````\n\n### Usage\n\nnote: **warmUp** should always be called in the **Main Thread**.\n\nWhen you want to speed up the loading of a WebView, perform the following request with the required URL / URLRequest to load. \n\n````swift\nlet url = URL(string: \"https://duckduckgo.com\")!\nWKWebViewHeater.shared.warmUp(with: url)\n````\n\nThis call should be done as soon as possible, and before your app makes all the critical calls, so the calls performed by the **WKWebViewHeater**.\n\nThen, when you want to retrieve the warmed-up WebView, just call\n\n````swift\nlet webView = WKWebViewHeater.shared.dequeue(with: url)!\n````\n\n#### Lifespan\n\nWarmed-up WebView may have a lifespan. In case the end of life of a WebView happens when it's inside the pool (not yet dequeued), the pool will reload it by calling the **warmUp** method over the WebView automatically.\n\n````swift\nlet url = URL(string: \"https://duckduckgo.com\")!\nWKWebViewHeater.shared.warmUp(with: url, lifespan: 30.0)  //WebView will be automatically reloaded every 30 seconds.\n````\n\n### Notes\n\n**Remember that** this WebView's size is Zero! In order to added to your ViewController, use AutoLayout as follows:\n\n````swift\n// Declare a variable that holds the WebView\nprivate lazy var webView: WKWebView = {\n    let webView: WKWebView!\n    webView = WKWebViewHeater.shared.dequeue(url: urlString)\n    \n    // Set other properties of the WebView\n    webView.configuration.allowsInlineMediaPlayback = true\n    \n    webView.translatesAutoresizingMaskIntoConstraints = false\n    webView.scrollView.alwaysBounceHorizontal = false\n    return webView\n}()\n\noverride func viewDidLoad() {\n    super.viewDidLoad()\n\n    // Add the WebView\n    view.addSubview(webView)\n\n    // Set WebView's delegate and props\n    webView.navigationDelegate = self\n    \n    // User AutoLayout to set its constraints\n    let webViewConstraints = [\n        webView.topAnchor.constraint(equalTo: view.topAnchor),\n        webView.leftAnchor.constraint(equalTo: view.leftAnchor),\n        webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),\n        webView.rightAnchor.constraint(equalTo: view.rightAnchor)\n    ]\n    NSLayoutConstraint.activate(webViewConstraints)\n}\n````\n\n### Author\n© 2020 Ezequiel (Kimi) Aceto\n\nThis project is distributed under [**MIT** License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feaceto%2Fwkwebview_warmup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feaceto%2Fwkwebview_warmup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feaceto%2Fwkwebview_warmup/lists"}