fetchDataRecords(ofTypes:completionHandler:)
Fetches the specified types of records from the data store.
Declaration
func fetchDataRecords(ofTypes dataTypes: Set<String>, completionHandler: @escaping @MainActor @Sendable ([WKWebsiteDataRecord]) -> Void)func dataRecords(ofTypes dataTypes: Set<String>) async -> [WKWebsiteDataRecord]Parameters
- dataTypes:
The types of records to fetch. For a list of all possible types, see Data Store Record Types. To specify all types, specify the set returned by the Allwebsitedatatypes() method.
- completionHandler:
The completion handler block to execute asynchronously with the results. This block has no return value and takes the following parameter:
- dataRecordArray
An array of Wkwebsitedatarecord objects. Each object in this array corresponds to data for one of the requested types. If no records of the requested types exist, this array is empty.
Discussion
Call this method to retrieve information about the types of data that the website saves. The returned records don’t include the data itself, but contain information that you can convey to the user. For example, you might use the returned data records to display the cookies a website uses, or to show which websites cache data.