<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Screen Time",
  "identifier" : "/documentation/ScreenTime/STWebHistory",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Screen Time"
    ],
    "preciseIdentifier" : "c:objc(cs)STWebHistory"
  },
  "title" : "STWebHistory"
}
-->

# STWebHistory

The object you use to delete web-usage data.

```
class STWebHistory
```

## Overview

This class provides an easy way for you to delete web history, including:

- All history
- History associated to a specific URL
- History during a specific time interval

## Topics

### Initializers

[`init(bundleIdentifier: String) throws`](/documentation/ScreenTime/STWebHistory/init(bundleIdentifier:))

Creates a web history instance to delete web-usage data associated to the
bundle identifier you specify.

### Instance methods

[`func deleteAllHistory()`](/documentation/ScreenTime/STWebHistory/deleteAllHistory())

Deletes all web history associated with the bundle identifier you specified
during initialization.

[`func deleteHistory(during: DateInterval)`](/documentation/ScreenTime/STWebHistory/deleteHistory(during:))

Deletes web history that occurred during the date interval you specify.

[`func deleteHistory(for: URL)`](/documentation/ScreenTime/STWebHistory/deleteHistory(for:))

Deletes all the web history for the URL you specify.

### Structures

[`struct ProfileIdentifier`](/documentation/ScreenTime/STWebHistory/ProfileIdentifier)

An identifier representing a web history profile.

### Initializers

[`init(bundleIdentifier: String, profileIdentifier: STWebHistory.ProfileIdentifier?) throws`](/documentation/ScreenTime/STWebHistory/init(bundleIdentifier:profileIdentifier:))

Creates a web history instance to delete web-usage data associated to the
bundle identifier and profile identifier you specify.

[`init(profileIdentifier: STWebHistory.ProfileIdentifier?)`](/documentation/ScreenTime/STWebHistory/init(profileIdentifier:))

Creates a web history instance to delete web-usage data associated to the
profile identifier you specify.

### Instance Methods

[`func fetchAllHistory(completionHandler: (Set<URL>?, (any Error)?) -> Void)`](/documentation/ScreenTime/STWebHistory/fetchAllHistory(completionHandler:))

Fetches all web history associated with the bundle identifier and profile identifier
you specified during initialization.

[`func fetchHistory(during: DateInterval, completionHandler: (Set<URL>?, (any Error)?) -> Void)`](/documentation/ScreenTime/STWebHistory/fetchHistory(during:completionHandler:))

Fetches web history that occurred during the date interval you specify.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)