TechnologiesUI & App Frameworks

WebKit

iOSmacOStvOSwatchOSvisionOS

WebKit embeds web content in your iOS, macOS, and visionOS apps through WKWebView, a view that loads and renders HTML, CSS, and JavaScript. With it you control navigation, inject and run scripts, apply content rules, manage downloads, and register custom URL scheme handlers to serve resources from your app. The framework also exposes the Document Object Model directly through types such as DOMDocument, DOMElement, DOMNode, and CSS classes like DOMCSSStyleDeclaration and DOMCSSStyleSheet, letting you inspect and traverse a page's structure and styling.

Custom Scheme Handling 4

Serve resources for custom URL schemes loaded by a web view from within your app.

  • Pr
    WKURLSchemeTaskmacOS 10.13+
    A protocol for loading resources requested by a web view for a custom URL scheme.
  • Pr
    URLSchemeHandler
    A protocol for loading resources with URL schemes that WebKit doesn't handle.
  • St
    URLScheme
    A type representing a valid URL scheme.
  • En
    URLSchemeTaskResult
    A value used as part of a sequence of results from a ``URLSchemeHandler``, which can either be a `Data` or a `URLResponse`.

Navigation Policy 3

Inspect navigation actions and responses and decide whether the web view should proceed.

  • En
    WKNavigationTypemacOS 10.10+
    @enum WKNavigationType
  • En
    WKNavigationActionPolicymacOS 10.10+
    @enum WKNavigationActionPolicy
  • En
    WKNavigationResponsePolicymacOS 10.10+
    @enum WKNavigationResponsePolicy

Scripting and JavaScript Bridging 6

Inject user scripts and exchange values between Swift and the page's JavaScript context.

  • En
    WKUserScriptInjectionTimemacOS 10.10+
    @enum WKUserScriptInjectionTime
  • Cl
    WKJSHandlemacOS 27.0+
    A WKJSHandle object contains a reference to a JavaScript object.
  • Cl
    WKJSScriptingBuffermacOS 27.0+
    A WKJSScriptingBuffer object exposes an application controlled data buffer to JavaScript.
  • Cl
    WKJSSerializedNodemacOS 27.0+
    A `WKJSSerializedNode` object contains the serialized representation of a DOM node
  • Cl
    WebScriptObject
    @class WebScriptObject
  • Cl
    WebUndefined
    @class WebUndefined

Media, Permissions, and Capture 6

Control media playback and respond to requests for camera, microphone, and other device capture.

  • St
    WKAudiovisualMediaTypesmacOS 10.12+
    @enum WKAudiovisualMediaTypes
  • En
    WKMediaPlaybackStatemacOS 11.3+
    An enumeration describing the current playback state of media in a web view.
  • En
    WKMediaCaptureTypemacOS 12.0+
    An enumeration describing the kind of device capture, such as camera or microphone, a page requests.
  • En
    WKMediaCaptureStatemacOS 12.0+
    An enumeration describing whether a web view is actively capturing from a media device.
  • En
    WKPermissionDecisionmacOS 12.0+
    An enumeration describing how to respond to a page's request for a protected capability.
  • En
    WKDialogResult
    @enum WKDialogResult

Web View Configuration and Errors 4

Data-store types, interface direction, security options, and error codes that configure a web view.

  • St
    WKWebViewDataTypemacOS 26.0+
    An option set identifying categories of website data a web view stores.
  • En
    WKUserInterfaceDirectionPolicymacOS 10.12+
    @enum WKUserInterfaceDirectionPolicy
  • En
    WKSecurityRestrictionModemacOS 26.4+
    @enum WKSecurityRestrictionMode
  • St
    WKErrormacOS 10.10+
    A structure defining the error codes WebKit reports for failed operations.

Legacy WebView and Frames 6

The original Cocoa WebView class hierarchy for loading and displaying frames and their content.

  • Cl
    WebView
    A view that loads, displays, and manages interaction with web content using the legacy WebKit API.
  • Cl
    WebFrame
    @class WebFrame
  • Cl
    WebFrameView
    @class WebFrameView
  • Cl
    WebDataSource
    @class WebDataSource
  • Cl
    WebResource
    @class WebResource
  • Cl
    WebPreferences
    @class WebPreferences

History and Archives 5

Track back-forward navigation history and serialize loaded pages and their subresources.

  • Cl
    WebHistory
    @class WebHistory
  • Cl
    WebHistoryItem
    @class WebHistoryItem
  • Cl
    WebBackForwardList
    @class WebBackForwardList
  • Cl
    WebArchive
    @class WebArchive
  • Cl
    WebDownload
    @class WebDownload

WebView Delegates 9

Delegate protocols that observe loading, policy, editing, downloads, and user-interface events.

  • Pr
    WebFrameLoadDelegate
    @category WebFrameLoadDelegate
  • Pr
    WebPolicyDelegate
    @category WebPolicyDelegate
  • Pr
    WebPolicyDecisionListener
    @protocol WebPolicyDecisionListener
  • Pr
    WebResourceLoadDelegate
    @category WebResourceLoadDelegate
  • Pr
    WebUIDelegate
    @category WebUIDelegate
  • Pr
    WebEditingDelegate
    A protocol for controlling editing behavior within editable web content.
  • Pr
    WebDownloadDelegate
    @protocol WebDownloadDelegate
  • Pr
    WebOpenPanelResultListener
    @protocol WebOpenPanelResultListener
  • Pr
    WebPlugInViewFactory
    @protocol WebPlugInViewFactory

Document Views and Representation 4

Protocols that adapt views to display, search, and represent web document content.

  • Pr
    WebDocumentView
    @protocol WebDocumentView
  • Pr
    WebDocumentText
    @protocol WebDocumentText
  • Pr
    WebDocumentSearching
    @protocol WebDocumentSearching
  • Pr
    WebDocumentRepresentation
    @protocol WebDocumentRepresentation

Drag, Navigation, and Cache Options 5

Enumerations and option sets that describe legacy drag actions, navigation kinds, insertion, and caching.

  • St
    WebDragSourceAction
    @enum WebDragSourceAction
  • St
    WebDragDestinationAction
    @enum WebDragDestinationAction
  • En
    WebNavigationType
    @enum WebNavigationType
  • En
    WebViewInsertAction
    An enumeration describing how content is inserted during an editing operation.
  • En
    WebCacheModel
    @enum WebCacheModel

DOM Core 21

Base node types for traversing and manipulating a document's tree structure.

  • Cl
    DOMObject
    The base class for objects that wrap underlying DOM entities.
  • Cl
    DOMNode
    The base class representing a single node in the document tree.
  • Cl
    DOMNodeList
    An object providing ordered access to a collection of DOM nodes.
  • Cl
    DOMNamedNodeMap
    An object providing access to a collection of nodes addressed by name, such as attributes.
  • Cl
    DOMCharacterData
    The base class for nodes that contain character data, such as text and comments.
  • Cl
    DOMText
    An object representing a run of text within an element or attribute.
  • Cl
    DOMComment
    An object representing a comment node in the document.
  • Cl
    DOMCDATASection
    An object representing a CDATA section whose text is not parsed as markup.
  • Cl
    DOMAttr
    An object representing an attribute of an element.
  • Cl
    DOMElement
    An object representing an element node in the document tree.
  • Cl
    DOMDocument
    An object representing an entire document and the root of its node tree.
  • Cl
    DOMDocumentFragment
    An object representing a lightweight container of nodes detached from the document.
  • Cl
    DOMDocumentType
    An object representing the document type declaration of a document.
  • Cl
    DOMImplementation
    An object that provides methods independent of any particular document instance.
  • Cl
    DOMEntity
    An object representing an entity defined in the document type.
  • Cl
    DOMEntityReference
    An object representing a reference to an entity within the document.
  • Cl
    DOMProcessingInstruction
    An object representing a processing instruction node in the document.
  • Cl
    DOMCounter
    An object representing a CSS counter value.
  • Cl
    DOMAbstractView
    An object representing the view associated with a document, used by UI events.
  • Cl
    DOMRect
    An object representing a rectangle returned by DOM geometry queries.
  • Cl
    DOMRGBColor
    An object representing a color expressed as red, green, and blue components.

DOM Traversal, Ranges, and XPath 7

Iterate, walk, select ranges of, and query the document with XPath expressions.

  • Cl
    DOMNodeIterator
    An object that iterates over the nodes of a document subtree in document order.
  • Cl
    DOMTreeWalker
    An object that navigates a document subtree and supports moving between related nodes.
  • Pr
    DOMNodeFilter
    A protocol used to decide which nodes a traversal accepts or rejects.
  • Cl
    DOMRange
    An object representing a contiguous range of content within the document.
  • Cl
    DOMXPathExpression
    An object representing a compiled XPath expression that can be evaluated against a document.
  • Cl
    DOMXPathResult
    An object holding the result of evaluating an XPath expression.
  • Pr
    DOMXPathNSResolver
    A protocol that resolves namespace prefixes used in an XPath expression.

DOM Events 9

Event objects and listener interfaces dispatched as the user interacts with the page.

  • Cl
    DOMEvent
    The base class representing an event dispatched within the document.
  • Pr
    DOMEventTarget
    A protocol adopted by objects that can receive and dispatch DOM events.
  • Pr
    DOMEventListener
    A protocol implemented by objects that handle dispatched DOM events.
  • Cl
    DOMUIEvent
    An object representing a user-interface event such as focus or scroll.
  • Cl
    DOMMouseEvent
    An object representing an event generated by mouse interaction.
  • Cl
    DOMKeyboardEvent
    An object representing an event generated by keyboard input.
  • Cl
    DOMWheelEvent
    An object representing an event generated by scroll wheel movement.
  • Cl
    DOMMutationEvent
    An object representing an event signaling a change to the document tree.
  • Cl
    DOMOverflowEvent
    An object representing an event signaling that an element's content overflowed its box.

DOM CSS 17

Read and modify the style sheets, rules, and computed values applied to a document.

  • Cl
    DOMStyleSheet
    The base class representing a style sheet applied to the document.
  • Cl
    DOMStyleSheetList
    An object providing access to the collection of style sheets in a document.
  • Cl
    DOMMediaList
    An object representing the list of media queries associated with a style sheet.
  • Cl
    DOMCSSStyleSheet
    An object representing a CSS style sheet and its collection of rules.
  • Cl
    DOMCSSRule
    The base class representing a single rule within a CSS style sheet.
  • Cl
    DOMCSSRuleList
    An object providing access to the rules contained in a style sheet.
  • Cl
    DOMCSSStyleRule
    An object representing a CSS style rule with a selector and declarations.
  • Cl
    DOMCSSCharsetRule
    An object representing a CSS @charset rule.
  • Cl
    DOMCSSFontFaceRule
    An object representing a CSS @font-face rule.
  • Cl
    DOMCSSImportRule
    An object representing a CSS @import rule.
  • Cl
    DOMCSSMediaRule
    An object representing a CSS @media rule and its nested rules.
  • Cl
    DOMCSSPageRule
    An object representing a CSS @page rule.
  • Cl
    DOMCSSUnknownRule
    An object representing a CSS rule that WebKit does not recognize.
  • Cl
    DOMCSSStyleDeclaration
    An object representing a block of CSS property declarations.
  • Cl
    DOMCSSValue
    The base class representing the value of a CSS property.
  • Cl
    DOMCSSValueList
    An object representing an ordered list of CSS values.
  • Cl
    DOMCSSPrimitiveValue
    An object representing a single primitive CSS value, such as a length or color.

DOM HTML Document and Structure 13

HTML-specific document, element base, and the root structural elements of a page.

  • Cl
    DOMHTMLDocument
    An object representing an HTML document and its specialized members.
  • Cl
    DOMHTMLElement
    The base class for elements in an HTML document.
  • Cl
    DOMHTMLHtmlElement
    An object representing the root html element of a page.
  • Cl
    DOMHTMLHeadElement
    An object representing the head element of a page.
  • Cl
    DOMHTMLBodyElement
    An object representing the body element of a page.
  • Cl
    DOMHTMLTitleElement
    An object representing the document's title element.
  • Cl
    DOMHTMLBaseElement
    An object representing a base element that sets a document's base URL.
  • Cl
    DOMHTMLBaseFontElement
    An object representing a basefont element specifying default font settings.
  • Cl
    DOMHTMLMetaElement
    An object representing a meta element that carries document metadata.
  • Cl
    DOMHTMLLinkElement
    An object representing a link element that references an external resource.
  • Cl
    DOMHTMLStyleElement
    An object representing a style element containing embedded CSS.
  • Cl
    DOMHTMLScriptElement
    An object representing a script element containing or referencing JavaScript.
  • Cl
    DOMHTMLCollection
    An object providing ordered access to a collection of HTML elements.

DOM HTML Text and Block Elements 17

Elements for headings, paragraphs, lists, quotes, and other block-level and inline content.

  • Cl
    DOMHTMLDivElement
    An object representing a div block-level container element.
  • Cl
    DOMHTMLParagraphElement
    An object representing a paragraph element.
  • Cl
    DOMHTMLHeadingElement
    An object representing a heading element such as h1 through h6.
  • Cl
    DOMHTMLPreElement
    An object representing a preformatted text element.
  • Cl
    DOMHTMLQuoteElement
    An object representing a blockquote or inline quotation element.
  • Cl
    DOMHTMLModElement
    An object representing an inserted or deleted content element.
  • Cl
    DOMHTMLBRElement
    An object representing a line break element.
  • Cl
    DOMHTMLHRElement
    An object representing a horizontal rule element.
  • Cl
    DOMHTMLFontElement
    An object representing a font element specifying text appearance.
  • Cl
    DOMHTMLMarqueeElement
    An object representing a scrolling marquee element.
  • Cl
    DOMHTMLAnchorElement
    An object representing an anchor element used for hyperlinks.
  • Cl
    DOMHTMLUListElement
    An object representing an unordered list element.
  • Cl
    DOMHTMLOListElement
    An object representing an ordered list element.
  • Cl
    DOMHTMLDListElement
    An object representing a definition list element.
  • Cl
    DOMHTMLLIElement
    An object representing a list item element.
  • Cl
    DOMHTMLDirectoryElement
    An object representing a directory list element.
  • Cl
    DOMHTMLMenuElement
    An object representing a menu list element.

DOM HTML Forms 11

Elements that build and process interactive forms and their input controls.

  • Cl
    DOMHTMLFormElement
    An object representing a form element that gathers and submits user input.
  • Cl
    DOMHTMLInputElement
    An object representing an input control element.
  • Cl
    DOMHTMLButtonElement
    An object representing a button element.
  • Cl
    DOMHTMLTextAreaElement
    An object representing a multi-line text input element.
  • Cl
    DOMHTMLSelectElement
    An object representing a select menu element.
  • Cl
    DOMHTMLOptionElement
    An object representing an option within a select menu.
  • Cl
    DOMHTMLOptGroupElement
    An object representing a group of options within a select menu.
  • Cl
    DOMHTMLOptionsCollection
    An object providing ordered access to the options of a select menu.
  • Cl
    DOMHTMLLabelElement
    An object representing a label associated with a form control.
  • Cl
    DOMHTMLLegendElement
    An object representing a caption for a field set.
  • Cl
    DOMHTMLFieldSetElement
    An object representing a field set that groups related form controls.

DOM HTML Tables 6

Elements that define tables and their captions, columns, sections, rows, and cells.

  • Cl
    DOMHTMLTableElement
    An object representing a table element.
  • Cl
    DOMHTMLTableCaptionElement
    An object representing a table's caption element.
  • Cl
    DOMHTMLTableColElement
    An object representing a table column or column group element.
  • Cl
    DOMHTMLTableSectionElement
    An object representing a table header, body, or footer section.
  • Cl
    DOMHTMLTableRowElement
    An object representing a row within a table.
  • Cl
    DOMHTMLTableCellElement
    An object representing a cell within a table row.

DOM HTML Media and Embedded Content 10

Elements that embed images, image maps, plug-ins, frames, and other external content.

  • Cl
    DOMHTMLImageElement
    An object representing an image element.
  • Cl
    DOMHTMLMapElement
    An object representing a client-side image map element.
  • Cl
    DOMHTMLAreaElement
    An object representing a clickable area within an image map.
  • Cl
    DOMHTMLObjectElement
    An object representing an embedded object element.
  • Cl
    DOMHTMLParamElement
    An object representing a parameter passed to an embedded object.
  • Cl
    DOMHTMLEmbedElement
    An object representing an embedded external content element.
  • Cl
    DOMHTMLAppletElement
    An object representing an embedded applet element.
  • Cl
    DOMHTMLIFrameElement
    An object representing an inline frame element.
  • Cl
    DOMHTMLFrameElement
    An object representing a frame within a frame set.
  • Cl
    DOMHTMLFrameSetElement
    An object representing a frame set that arranges multiple frames.

DOM Files and Binary Data 3

Types representing files and binary blobs exposed to the page.

  • Cl
    DOMFile
    An object representing a file exposed to the document.
  • Cl
    DOMFileList
    An object providing ordered access to a collection of files.
  • Cl
    DOMBlob
    An object representing an immutable chunk of binary data.

DOM Exception Codes 4

Constants identifying errors raised by DOM, event, range, and XPath operations.

  • St
    DOMExceptionCode
    Constants identifying errors raised by core DOM operations.
  • St
    DOMEventExceptionCode
    Constants identifying errors raised by DOM event operations.
  • St
    DOMRangeExceptionCode
    Constants identifying errors raised by DOM range operations.
  • St
    DOMXPathExceptionCode
    Constants identifying errors raised by XPath evaluation.

Classes 34

  • Cl
    WKBackForwardListmacOS 10.10+
    @abstract A WKBackForwardList object is a list of webpages previously
  • Cl
    WKBackForwardListItemmacOS 10.10+
    A WKBackForwardListItem object represents a webpage in the back-forward list of a web view.
  • Cl
    WKContentRuleListmacOS 10.13+
  • Cl
    WKContentRuleListStoremacOS 10.13+
  • Cl
    WKContentWorldmacOS 11.0+
    @abstract A WKContentWorld object allows you to separate your application's interaction with content displayed in a WKWebView into different roles that cannot interfere with one another.
  • Cl
    WKContentWorldConfigurationmacOS 27.0+
    @abstract A WKContentWorldConfiguration object allows you to specify custom behavior for a WKContentWorld instance.
  • Cl
    WKDownloadmacOS 11.3+
  • Cl
    WKFindConfigurationmacOS 10.15.4+
  • Cl
    WKFindResultmacOS 10.15.4+
  • Cl
    WKFormInfomacOS 27.0+
    @abstract A WKFormInfo object contains information about an in-progress form submission happening in a WKWebView
  • Cl
    WKFrameInfomacOS 10.10+
    A WKFrameInfo object contains information about a frame on a webpage.
  • Cl
    WKHTTPCookieStoremacOS 10.13+
    A WKHTTPCookieStore object allows managing the HTTP cookies associated with a particular WKWebsiteDataStore.
  • Cl
    WKNavigationmacOS 10.10+
    A WKNavigation object can be used for tracking the loading progress of a webpage.
  • Cl
    WKNavigationActionmacOS 10.10+
    A WKNavigationAction object contains information about an action that may cause a navigation, used for making policy decisions.
  • Cl
    WKNavigationResponsemacOS 10.10+
    Contains information about a navigation response, used for making policy decisions.
  • Cl
    WKOpenPanelParametersmacOS 10.12+
    WKOpenPanelParameters contains parameters that a file upload control has specified.
Show 18 more
  • Cl
    WKPDFConfigurationmacOS 10.15.4+
  • Cl
    WKPreferencesmacOS 10.10+
    A WKPreferences object encapsulates the preference settings for a web
  • Cl
    WKProcessPool
    A WKProcessPool object represents a pool of web content processes.
  • Cl
    WKScriptMessagemacOS 10.10+
    A WKScriptMessage object contains information about a message sent from
  • Cl
    WKSecurityOriginmacOS 10.11+
    A WKSecurityOrigin object contains information about a security origin.
  • Cl
    WKSnapshotConfigurationmacOS 10.13+
  • Cl
    WKUserContentControllermacOS 10.10+
    A WKUserContentController object provides a way for JavaScript to post
  • Cl
    WKUserScriptmacOS 10.10+
    A @link WKUserScript @/link object represents a script that can be injected into webpages.
  • Cl
    WKWebExtensionmacOS 15.4+
    @abstract A ``WKWebExtension`` object encapsulates a web extension’s resources that are defined by a `manifest.json`` file.
  • Cl
    WKWebExtensionContextmacOS 15.4+
    @abstract A ``WKWebExtensionContext`` object represents the runtime environment for a web extension.
  • Cl
    WKWebExtensionControllermacOS 15.4+
    @abstract A ``WKWebExtensionController`` object manages a set of loaded extension contexts.
  • Cl
    WKWebViewmacOS 10.10+
  • Cl
    WKWebViewConfigurationmacOS 10.10+
    A WKWebViewConfiguration object is a collection of properties with
  • Cl
    WKWebpagePreferencesmacOS 10.15+
    A WKWebpagePreferences object is a collection of properties that
  • Cl
    WKWebsiteDataRecordmacOS 10.11+
    A WKWebsiteDataRecord represents website data, grouped by domain name using the public suffix list.
  • Cl
    WKWebsiteDataStoremacOS 10.11+
    A WKWebsiteDataStore represents various types of data that a website might
  • Cl
    WKWindowFeaturesmacOS 10.10+
    WKWindowFeatures specifies optional attributes for the containing window when a new WKWebView is requested.
  • Cl
    WebPage
    An object that controls and manages the behavior of interactive web content.

Protocols 10

  • Pr
    WKDownloadDelegate
  • Pr
    WKHTTPCookieStoreObservermacOS 10.13+
  • Pr
    WKNavigationDelegate
    A class conforming to the WKNavigationDelegate protocol can provide
  • Pr
    WKScriptMessageHandler
    A class conforming to the WKScriptMessageHandler protocol provides a
  • Pr
    WKScriptMessageHandlerWithReply
    A class conforming to the WKScriptMessageHandlerWithReply protocol provides a
  • Pr
    WKUIDelegate
    A class conforming to the WKUIDelegate protocol provides methods for
  • Pr
    WKURLSchemeHandlermacOS 10.13+
    A class conforming to the WKURLSchemeHandler protocol provides methods for
  • Pr
    WKWebExtensionControllerDelegatemacOS 15.4+
  • Pr
    WKWebExtensionTabmacOS 15.4+
    @abstract A class conforming to the ``WKWebExtensionTab`` protocol represents a tab to web extensions.
  • Pr
    WKWebExtensionWindowmacOS 15.4+
    @abstract A class conforming to the ``WKWebExtensionWindow`` protocol represents a window to web extensions.

Type Aliases 1

  • Ty
    DOMTimeStamp

Extends 4

NSAttributedStringNSNotificationNSObjectView
← UI & App Frameworks