A WKWebsiteDataStore object represents various types of data used by a chosen website. Data types include cookies, disk and memory caches, and persistent data such as WebSQL, IndexedDB databases, and local storage.


class WKWebsiteDataStore : NSObject


Retrieving a Data Store

class func `default`() -> WKWebsiteDataStore

Returns the default data store.

class func nonPersistent() -> WKWebsiteDataStore

Returns a new nonpersistent data store.

Inspecting Data Store Properties

var isPersistent: Bool

A Boolean value that specifies whether the data store is persistent.

Retrieving a Cookie Store

var httpCookieStore: WKHTTPCookieStore

Returns a cookie store with the HTTP cookies in this website data store.

class WKHTTPCookieStore

An object that manages the HTTP cookies associated with a particular WKWebsiteDataStore.

Retrieving Specific Types of Data

class func allWebsiteDataTypes() -> Set<String>

Returns a set of all the available data types.

Removing Specific Types of Data

func removeData(ofTypes: Set<String>, for: [WKWebsiteDataRecord], completionHandler: () -> Void)

Removes the specified types of website data from the given data records.

func removeData(ofTypes: Set<String>, modifiedSince: Date, completionHandler: () -> Void)

Removes the specified types of data if the data was changed since the given date.


Inherits From

See Also

Website Data

class WKWebsiteDataRecord

A WKWebsiteDataRecord object represents website data grouped by the originating URL’s domain name and suffix.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software