🌐

WebKit

iOS 8+

Apple's framework for displaying web content in your app. WebKit provides WKWebView for rendering HTML, CSS, and JavaScript with the same engine used by Safari.

Web
Official Apple Documentation →
iOS Version Compatibility
99.7%
coverage

of iOS users worldwide can use WebKit (iOS 8+ required)

iOS VersionMarket ShareStatus
iOS 18.730.3%Supported
iOS 18.629.8%Supported
iOS 26.110.7%Supported
iOS 18.56.0%Supported
iOS 16.72.3%Supported
iOS 26.22.0%Supported
iOS 18.31.8%Supported
iOS 15.81.8%Supported
iOS 11.01.7%Supported
iOS 17.61.7%Supported

Key Features

Modern web content rendering

JavaScript execution

CSS and HTML5 support

Two-way communication with JavaScript

Content blocking and filtering

Custom URL scheme handling

Code Examples

Display Web Content

Create a web view and load a URL

import WebKit
import UIKit

class WebViewController: UIViewController {
    var webView: WKWebView!
    
    override func loadView() {
        let configuration = WKWebViewConfiguration()
        webView = WKWebView(frame: .zero, configuration: configuration)
        webView.navigationDelegate = self
        view = webView
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        if let url = URL(string: "https://www.apple.com") {
            webView.load(URLRequest(url: url))
        }
    }
}

extension WebViewController: WKNavigationDelegate {
    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
        print("Finished loading")
    }
}

Execute JavaScript

Run JavaScript code in the web view

import WebKit

func executeJavaScript(in webView: WKWebView) {
    let script = "document.body.style.backgroundColor = 'lightblue';"
    
    webView.evaluateJavaScript(script) { result, error in
        if let error = error {
            print("Error: \(error)")
        } else {
            print("Script executed")
        }
    }
}

Frequently Asked Questions

What is WebKit?

Apple's framework for displaying web content in your app. WebKit provides WKWebView for rendering HTML, CSS, and JavaScript with the same engine used by Safari.

Which iOS versions support WebKit?

WebKit is available on iOS 8 and later. Currently, 99.7% of iOS users worldwide can use this framework.

What are alternatives to WebKit?

Related frameworks include Safariservices. Each has different capabilities and iOS version requirements.