<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetricKit",
  "identifier" : "/documentation/MetricKit/Histogram",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "MetricKit"
    ],
    "preciseIdentifier" : "s:9MetricKit9HistogramV"
  },
  "title" : "Histogram"
}
-->

# Histogram

A distribution of values organized into buckets.

```
struct Histogram<DimensionType> where DimensionType : Dimension
```

## Discussion

Each [`Histogram.Bucket`](/documentation/MetricKit/Histogram/Bucket) in the [`buckets`](/documentation/MetricKit/Histogram/buckets) array covers a range from [`lowerBound`](/documentation/MetricKit/Histogram/Bucket/lowerBound) to [`upperBound`](/documentation/MetricKit/Histogram/Bucket/upperBound) and reports the number of samples in that range via [`count`](/documentation/MetricKit/Histogram/Bucket/count).

You encounter `Histogram` as the type of properties on various metric structs, such as [`histogram`](/documentation/MetricKit/HangTimeMetric/histogram) and [`histogram`](/documentation/MetricKit/TimeToFirstDrawMetric/histogram):

```swift
let histogram = metric.histogram // Histogram<UnitDuration>
for bucket in histogram.buckets {
    let lower = bucket.lowerBound
    let upper = bucket.upperBound
    let count = bucket.count
}
```

## Topics

### Buckets

[`let buckets: [Histogram<DimensionType>.Bucket]`](/documentation/MetricKit/Histogram/buckets)

### Structures

[`struct Bucket`](/documentation/MetricKit/Histogram/Bucket)

## Relationships

### Conforms To

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

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

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

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

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

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

---

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)