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.
- PrWKURLSchemeTaskmacOS 10.13+A protocol for loading resources requested by a web view for a custom URL scheme.
- PrURLSchemeHandlerA protocol for loading resources with URL schemes that WebKit doesn't handle.
- StURLSchemeA type representing a valid URL scheme.
- EnURLSchemeTaskResultA 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.
- EnWKNavigationTypemacOS 10.10+@enum WKNavigationType
- EnWKNavigationActionPolicymacOS 10.10+@enum WKNavigationActionPolicy
- EnWKNavigationResponsePolicymacOS 10.10+@enum WKNavigationResponsePolicy
Scripting and JavaScript Bridging 6
Inject user scripts and exchange values between Swift and the page's JavaScript context.
- EnWKUserScriptInjectionTimemacOS 10.10+@enum WKUserScriptInjectionTime
- ClWKJSHandlemacOS 27.0+A WKJSHandle object contains a reference to a JavaScript object.
- ClWKJSScriptingBuffermacOS 27.0+A WKJSScriptingBuffer object exposes an application controlled data buffer to JavaScript.
- ClWKJSSerializedNodemacOS 27.0+A `WKJSSerializedNode` object contains the serialized representation of a DOM node
- ClWebScriptObject@class WebScriptObject
- ClWebUndefined@class WebUndefined
Media, Permissions, and Capture 6
Control media playback and respond to requests for camera, microphone, and other device capture.
- StWKAudiovisualMediaTypesmacOS 10.12+@enum WKAudiovisualMediaTypes
- EnWKMediaPlaybackStatemacOS 11.3+An enumeration describing the current playback state of media in a web view.
- EnWKMediaCaptureTypemacOS 12.0+An enumeration describing the kind of device capture, such as camera or microphone, a page requests.
- EnWKMediaCaptureStatemacOS 12.0+An enumeration describing whether a web view is actively capturing from a media device.
- EnWKPermissionDecisionmacOS 12.0+An enumeration describing how to respond to a page's request for a protected capability.
- EnWKDialogResult@enum WKDialogResult
Web View Configuration and Errors 4
Data-store types, interface direction, security options, and error codes that configure a web view.
- StWKWebViewDataTypemacOS 26.0+An option set identifying categories of website data a web view stores.
- EnWKUserInterfaceDirectionPolicymacOS 10.12+@enum WKUserInterfaceDirectionPolicy
- EnWKSecurityRestrictionModemacOS 26.4+@enum WKSecurityRestrictionMode
- StWKErrormacOS 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.
- ClWebViewA view that loads, displays, and manages interaction with web content using the legacy WebKit API.
- ClWebFrame@class WebFrame
- ClWebFrameView@class WebFrameView
- ClWebDataSource@class WebDataSource
- ClWebResource@class WebResource
- ClWebPreferences@class WebPreferences
History and Archives 5
Track back-forward navigation history and serialize loaded pages and their subresources.
- ClWebHistory@class WebHistory
- ClWebHistoryItem@class WebHistoryItem
- ClWebBackForwardList@class WebBackForwardList
- ClWebArchive@class WebArchive
- ClWebDownload@class WebDownload
WebView Delegates 9
Delegate protocols that observe loading, policy, editing, downloads, and user-interface events.
- PrWebFrameLoadDelegate@category WebFrameLoadDelegate
- PrWebPolicyDelegate@category WebPolicyDelegate
- PrWebPolicyDecisionListener@protocol WebPolicyDecisionListener
- PrWebResourceLoadDelegate@category WebResourceLoadDelegate
- PrWebUIDelegate@category WebUIDelegate
- PrWebEditingDelegateA protocol for controlling editing behavior within editable web content.
- PrWebDownloadDelegate@protocol WebDownloadDelegate
- PrWebOpenPanelResultListener@protocol WebOpenPanelResultListener
- PrWebPlugInViewFactory@protocol WebPlugInViewFactory
Document Views and Representation 4
Protocols that adapt views to display, search, and represent web document content.
- PrWebDocumentView@protocol WebDocumentView
- PrWebDocumentText@protocol WebDocumentText
- PrWebDocumentSearching@protocol WebDocumentSearching
- PrWebDocumentRepresentation@protocol WebDocumentRepresentation
Drag, Navigation, and Cache Options 5
Enumerations and option sets that describe legacy drag actions, navigation kinds, insertion, and caching.
- StWebDragSourceAction@enum WebDragSourceAction
- StWebDragDestinationAction@enum WebDragDestinationAction
- EnWebNavigationType@enum WebNavigationType
- EnWebViewInsertActionAn enumeration describing how content is inserted during an editing operation.
- EnWebCacheModel@enum WebCacheModel
DOM Core 21
Base node types for traversing and manipulating a document's tree structure.
- ClDOMObjectThe base class for objects that wrap underlying DOM entities.
- ClDOMNodeThe base class representing a single node in the document tree.
- ClDOMNodeListAn object providing ordered access to a collection of DOM nodes.
- ClDOMNamedNodeMapAn object providing access to a collection of nodes addressed by name, such as attributes.
- ClDOMCharacterDataThe base class for nodes that contain character data, such as text and comments.
- ClDOMTextAn object representing a run of text within an element or attribute.
- ClDOMCommentAn object representing a comment node in the document.
- ClDOMCDATASectionAn object representing a CDATA section whose text is not parsed as markup.
- ClDOMAttrAn object representing an attribute of an element.
- ClDOMElementAn object representing an element node in the document tree.
- ClDOMDocumentAn object representing an entire document and the root of its node tree.
- ClDOMDocumentFragmentAn object representing a lightweight container of nodes detached from the document.
- ClDOMDocumentTypeAn object representing the document type declaration of a document.
- ClDOMImplementationAn object that provides methods independent of any particular document instance.
- ClDOMEntityAn object representing an entity defined in the document type.
- ClDOMEntityReferenceAn object representing a reference to an entity within the document.
- ClDOMProcessingInstructionAn object representing a processing instruction node in the document.
- ClDOMCounterAn object representing a CSS counter value.
- ClDOMAbstractViewAn object representing the view associated with a document, used by UI events.
- ClDOMRectAn object representing a rectangle returned by DOM geometry queries.
- ClDOMRGBColorAn 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.
- ClDOMNodeIteratorAn object that iterates over the nodes of a document subtree in document order.
- ClDOMTreeWalkerAn object that navigates a document subtree and supports moving between related nodes.
- PrDOMNodeFilterA protocol used to decide which nodes a traversal accepts or rejects.
- ClDOMRangeAn object representing a contiguous range of content within the document.
- ClDOMXPathExpressionAn object representing a compiled XPath expression that can be evaluated against a document.
- ClDOMXPathResultAn object holding the result of evaluating an XPath expression.
- PrDOMXPathNSResolverA 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.
- ClDOMEventThe base class representing an event dispatched within the document.
- PrDOMEventTargetA protocol adopted by objects that can receive and dispatch DOM events.
- PrDOMEventListenerA protocol implemented by objects that handle dispatched DOM events.
- ClDOMUIEventAn object representing a user-interface event such as focus or scroll.
- ClDOMMouseEventAn object representing an event generated by mouse interaction.
- ClDOMKeyboardEventAn object representing an event generated by keyboard input.
- ClDOMWheelEventAn object representing an event generated by scroll wheel movement.
- ClDOMMutationEventAn object representing an event signaling a change to the document tree.
- ClDOMOverflowEventAn 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.
- ClDOMStyleSheetThe base class representing a style sheet applied to the document.
- ClDOMStyleSheetListAn object providing access to the collection of style sheets in a document.
- ClDOMMediaListAn object representing the list of media queries associated with a style sheet.
- ClDOMCSSStyleSheetAn object representing a CSS style sheet and its collection of rules.
- ClDOMCSSRuleThe base class representing a single rule within a CSS style sheet.
- ClDOMCSSRuleListAn object providing access to the rules contained in a style sheet.
- ClDOMCSSStyleRuleAn object representing a CSS style rule with a selector and declarations.
- ClDOMCSSCharsetRuleAn object representing a CSS @charset rule.
- ClDOMCSSFontFaceRuleAn object representing a CSS @font-face rule.
- ClDOMCSSImportRuleAn object representing a CSS @import rule.
- ClDOMCSSMediaRuleAn object representing a CSS @media rule and its nested rules.
- ClDOMCSSPageRuleAn object representing a CSS @page rule.
- ClDOMCSSUnknownRuleAn object representing a CSS rule that WebKit does not recognize.
- ClDOMCSSStyleDeclarationAn object representing a block of CSS property declarations.
- ClDOMCSSValueThe base class representing the value of a CSS property.
- ClDOMCSSValueListAn object representing an ordered list of CSS values.
- ClDOMCSSPrimitiveValueAn 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.
- ClDOMHTMLDocumentAn object representing an HTML document and its specialized members.
- ClDOMHTMLElementThe base class for elements in an HTML document.
- ClDOMHTMLHtmlElementAn object representing the root html element of a page.
- ClDOMHTMLHeadElementAn object representing the head element of a page.
- ClDOMHTMLBodyElementAn object representing the body element of a page.
- ClDOMHTMLTitleElementAn object representing the document's title element.
- ClDOMHTMLBaseElementAn object representing a base element that sets a document's base URL.
- ClDOMHTMLBaseFontElementAn object representing a basefont element specifying default font settings.
- ClDOMHTMLMetaElementAn object representing a meta element that carries document metadata.
- ClDOMHTMLLinkElementAn object representing a link element that references an external resource.
- ClDOMHTMLStyleElementAn object representing a style element containing embedded CSS.
- ClDOMHTMLScriptElementAn object representing a script element containing or referencing JavaScript.
- ClDOMHTMLCollectionAn 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.
- ClDOMHTMLDivElementAn object representing a div block-level container element.
- ClDOMHTMLParagraphElementAn object representing a paragraph element.
- ClDOMHTMLHeadingElementAn object representing a heading element such as h1 through h6.
- ClDOMHTMLPreElementAn object representing a preformatted text element.
- ClDOMHTMLQuoteElementAn object representing a blockquote or inline quotation element.
- ClDOMHTMLModElementAn object representing an inserted or deleted content element.
- ClDOMHTMLBRElementAn object representing a line break element.
- ClDOMHTMLHRElementAn object representing a horizontal rule element.
- ClDOMHTMLFontElementAn object representing a font element specifying text appearance.
- ClDOMHTMLMarqueeElementAn object representing a scrolling marquee element.
- ClDOMHTMLAnchorElementAn object representing an anchor element used for hyperlinks.
- ClDOMHTMLUListElementAn object representing an unordered list element.
- ClDOMHTMLOListElementAn object representing an ordered list element.
- ClDOMHTMLDListElementAn object representing a definition list element.
- ClDOMHTMLLIElementAn object representing a list item element.
- ClDOMHTMLDirectoryElementAn object representing a directory list element.
- ClDOMHTMLMenuElementAn object representing a menu list element.
DOM HTML Forms 11
Elements that build and process interactive forms and their input controls.
- ClDOMHTMLFormElementAn object representing a form element that gathers and submits user input.
- ClDOMHTMLInputElementAn object representing an input control element.
- ClDOMHTMLButtonElementAn object representing a button element.
- ClDOMHTMLTextAreaElementAn object representing a multi-line text input element.
- ClDOMHTMLSelectElementAn object representing a select menu element.
- ClDOMHTMLOptionElementAn object representing an option within a select menu.
- ClDOMHTMLOptGroupElementAn object representing a group of options within a select menu.
- ClDOMHTMLOptionsCollectionAn object providing ordered access to the options of a select menu.
- ClDOMHTMLLabelElementAn object representing a label associated with a form control.
- ClDOMHTMLLegendElementAn object representing a caption for a field set.
- ClDOMHTMLFieldSetElementAn 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.
- ClDOMHTMLTableElementAn object representing a table element.
- ClDOMHTMLTableCaptionElementAn object representing a table's caption element.
- ClDOMHTMLTableColElementAn object representing a table column or column group element.
- ClDOMHTMLTableSectionElementAn object representing a table header, body, or footer section.
- ClDOMHTMLTableRowElementAn object representing a row within a table.
- ClDOMHTMLTableCellElementAn 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.
- ClDOMHTMLImageElementAn object representing an image element.
- ClDOMHTMLMapElementAn object representing a client-side image map element.
- ClDOMHTMLAreaElementAn object representing a clickable area within an image map.
- ClDOMHTMLObjectElementAn object representing an embedded object element.
- ClDOMHTMLParamElementAn object representing a parameter passed to an embedded object.
- ClDOMHTMLEmbedElementAn object representing an embedded external content element.
- ClDOMHTMLAppletElementAn object representing an embedded applet element.
- ClDOMHTMLIFrameElementAn object representing an inline frame element.
- ClDOMHTMLFrameElementAn object representing a frame within a frame set.
- ClDOMHTMLFrameSetElementAn 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.
- ClDOMFileAn object representing a file exposed to the document.
- ClDOMFileListAn object providing ordered access to a collection of files.
- ClDOMBlobAn object representing an immutable chunk of binary data.
DOM Exception Codes 4
Constants identifying errors raised by DOM, event, range, and XPath operations.
- StDOMExceptionCodeConstants identifying errors raised by core DOM operations.
- StDOMEventExceptionCodeConstants identifying errors raised by DOM event operations.
- StDOMRangeExceptionCodeConstants identifying errors raised by DOM range operations.
- StDOMXPathExceptionCodeConstants identifying errors raised by XPath evaluation.
Classes 34
- ClWKBackForwardListmacOS 10.10+@abstract A WKBackForwardList object is a list of webpages previously
- ClWKBackForwardListItemmacOS 10.10+A WKBackForwardListItem object represents a webpage in the back-forward list of a web view.
- ClWKContentRuleListmacOS 10.13+
- ClWKContentRuleListStoremacOS 10.13+
- ClWKContentWorldmacOS 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.
- ClWKContentWorldConfigurationmacOS 27.0+@abstract A WKContentWorldConfiguration object allows you to specify custom behavior for a WKContentWorld instance.
- ClWKDownloadmacOS 11.3+
- ClWKFindConfigurationmacOS 10.15.4+
- ClWKFindResultmacOS 10.15.4+
- ClWKFormInfomacOS 27.0+@abstract A WKFormInfo object contains information about an in-progress form submission happening in a WKWebView
- ClWKFrameInfomacOS 10.10+A WKFrameInfo object contains information about a frame on a webpage.
- ClWKHTTPCookieStoremacOS 10.13+A WKHTTPCookieStore object allows managing the HTTP cookies associated with a particular WKWebsiteDataStore.
- ClWKNavigationmacOS 10.10+A WKNavigation object can be used for tracking the loading progress of a webpage.
- ClWKNavigationActionmacOS 10.10+A WKNavigationAction object contains information about an action that may cause a navigation, used for making policy decisions.
- ClWKNavigationResponsemacOS 10.10+Contains information about a navigation response, used for making policy decisions.
- ClWKOpenPanelParametersmacOS 10.12+WKOpenPanelParameters contains parameters that a file upload control has specified.
Show 18 more
- ClWKPDFConfigurationmacOS 10.15.4+
- ClWKPreferencesmacOS 10.10+A WKPreferences object encapsulates the preference settings for a web
- ClWKProcessPoolA WKProcessPool object represents a pool of web content processes.
- ClWKScriptMessagemacOS 10.10+A WKScriptMessage object contains information about a message sent from
- ClWKSecurityOriginmacOS 10.11+A WKSecurityOrigin object contains information about a security origin.
- ClWKSnapshotConfigurationmacOS 10.13+
- ClWKUserContentControllermacOS 10.10+A WKUserContentController object provides a way for JavaScript to post
- ClWKUserScriptmacOS 10.10+A @link WKUserScript @/link object represents a script that can be injected into webpages.
- ClWKWebExtensionmacOS 15.4+@abstract A ``WKWebExtension`` object encapsulates a web extension’s resources that are defined by a `manifest.json`` file.
- ClWKWebExtensionContextmacOS 15.4+@abstract A ``WKWebExtensionContext`` object represents the runtime environment for a web extension.
- ClWKWebExtensionControllermacOS 15.4+@abstract A ``WKWebExtensionController`` object manages a set of loaded extension contexts.
- ClWKWebViewmacOS 10.10+
- ClWKWebViewConfigurationmacOS 10.10+A WKWebViewConfiguration object is a collection of properties with
- ClWKWebpagePreferencesmacOS 10.15+A WKWebpagePreferences object is a collection of properties that
- ClWKWebsiteDataRecordmacOS 10.11+A WKWebsiteDataRecord represents website data, grouped by domain name using the public suffix list.
- ClWKWebsiteDataStoremacOS 10.11+A WKWebsiteDataStore represents various types of data that a website might
- ClWKWindowFeaturesmacOS 10.10+WKWindowFeatures specifies optional attributes for the containing window when a new WKWebView is requested.
- ClWebPageAn object that controls and manages the behavior of interactive web content.
Protocols 10
- PrWKDownloadDelegate
- PrWKHTTPCookieStoreObservermacOS 10.13+
- PrWKNavigationDelegateA class conforming to the WKNavigationDelegate protocol can provide
- PrWKScriptMessageHandlerA class conforming to the WKScriptMessageHandler protocol provides a
- PrWKScriptMessageHandlerWithReplyA class conforming to the WKScriptMessageHandlerWithReply protocol provides a
- PrWKUIDelegateA class conforming to the WKUIDelegate protocol provides methods for
- PrWKURLSchemeHandlermacOS 10.13+A class conforming to the WKURLSchemeHandler protocol provides methods for
- PrWKWebExtensionControllerDelegatemacOS 15.4+
- PrWKWebExtensionTabmacOS 15.4+@abstract A class conforming to the ``WKWebExtensionTab`` protocol represents a tab to web extensions.
- PrWKWebExtensionWindowmacOS 15.4+@abstract A class conforming to the ``WKWebExtensionWindow`` protocol represents a window to web extensions.
Type Aliases 1
- TyDOMTimeStamp