<!--
{
  "availability" : [
    "iOS: 26.0.0 - 27.0.0",
    "iPadOS: 26.0.0 - 27.0.0",
    "macCatalyst: 26.0.0 - 27.0.0",
    "macOS: 26.0.0 - 27.0.0",
    "visionOS: 26.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "MetricKit",
  "identifier" : "/documentation/MetricKit/MXDiskSpaceUsageMetric",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "MetricKit"
    ],
    "preciseIdentifier" : "c:objc(cs)MXDiskSpaceUsageMetric"
  },
  "title" : "MXDiskSpaceUsageMetric"
}
-->

# MXDiskSpaceUsageMetric

An object representing metrics about your app’s disk space usage.

```
class MXDiskSpaceUsageMetric
```

## Overview

This object provides insights on how your app utilizes disk space and related storage technologies, such as cache folders and clone files.

Disk space is a limited resource shared by many apps. Optimize your app’s disk space usage to provide a better customer experience. People can inspect your app’s disk footprint in Settings, and excessive usage may force them to remove your app to install new apps or perform system updates.

> Note: MetricKit reports MXDiskSpaceUsageMetric on devices running iOS 26 or later.

### Disk Space Measurements

Modern file systems such APFS provide enhanced features to maximize space utilization, such as file cloning. The disk space usage metric reports size accurately without double counting the cloned files.

For example, if you copy a file using <doc://com.apple.documentation/documentation/Foundation/FileManager/copyItem(at:to:)>, the file system shows two separate files. However, due to the file system optimization, the copied file shares the same storage space with the original file. If you manually calculate the size of all your files, your calculation may also include the copied file, resulting in a larger size than expected.

### Storing App-Specific Files

Use the [`totalCacheFolderSize`](/documentation/MetricKit/MXDiskSpaceUsageMetric/totalCacheFolderSize) property of MXDiskSpaceUsageMetric to gain insights into how the operating system manages your app’s cached content in the field. Placing files in the appropriate directories, such as the <doc://com.apple.documentation/documentation/Foundation/URL/cachesDirectory> and <doc://com.apple.documentation/documentation/Foundation/URL/temporaryDirectory> (see [File System Basics](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html)), allows the system to intelligently manage and purge content when necessary, ensuring optimal disk space utilization and a better user experience.

## Topics

### Reading file counts

[`totalBinaryFileCount`](/documentation/MetricKit/MXDiskSpaceUsageMetric/totalBinaryFileCount)

The total number of your app’s binary files.

[`totalDataFileCount`](/documentation/MetricKit/MXDiskSpaceUsageMetric/totalDataFileCount)

The total number of data files in your app’s container(s).

### Reading file sizes

[`totalBinaryFileSize`](/documentation/MetricKit/MXDiskSpaceUsageMetric/totalBinaryFileSize)

The total size of disk space your app’s binary files occupy.

[`totalCacheFolderSize`](/documentation/MetricKit/MXDiskSpaceUsageMetric/totalCacheFolderSize)

The total size of your application’s cache folder.

[`totalCloneSize`](/documentation/MetricKit/MXDiskSpaceUsageMetric/totalCloneSize)

The total size of all clone files that are attributed to your app.

[`totalDataFileSize`](/documentation/MetricKit/MXDiskSpaceUsageMetric/totalDataFileSize)

The total size of disk space your app uses for storing data files.

### Reading disk capacity and space

[`totalDiskSpaceCapacity`](/documentation/MetricKit/MXDiskSpaceUsageMetric/totalDiskSpaceCapacity)

The total disk space capacity of the current device.

[`totalDiskSpaceUsedSize`](/documentation/MetricKit/MXDiskSpaceUsageMetric/totalDiskSpaceUsedSize)

The total amount of used disk storage on the current device.

## Relationships

### Conforms To

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

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

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`NSCoding`](/documentation/Foundation/NSCoding)

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

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

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

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

### Inherits From

[`MXMetric`](/documentation/MetricKit/MXMetric)

---

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)