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

# ForegroundTerminationMetric

A metric that counts app terminations from the foreground by category.

```
struct ForegroundTerminationMetric
```

## Discussion

This metric corresponds to the [`MetricResult.foregroundTermination(_:)`](/documentation/MetricKit/MetricResult/foregroundTermination(_:)) case. It appears in both [`intervalEntries`](/documentation/MetricKit/MetricReport/intervalEntries) and [`stateEntries`](/documentation/MetricKit/MetricReport/stateEntries) when state reporting is enabled.

Foreground exits are user-visible terminations; when unexpected, they directly interrupt usage. Not all exits are unexpected — normal exits such as the user quitting the app from the switcher appear in [`normalTerminationCount`](/documentation/MetricKit/ForegroundTerminationMetric/normalTerminationCount).

Use [`terminationCategory`](/documentation/MetricKit/CrashDiagnostic/terminationCategory-swift.property) to correlate individual crash diagnostics with these aggregate counts.

## Topics

### Foreground termination counts

[`let normalTerminationCount: Int`](/documentation/MetricKit/ForegroundTerminationMetric/normalTerminationCount)

The number of times the application terminated normally from the foreground.

[`let memoryLimitTerminationCount: Int`](/documentation/MetricKit/ForegroundTerminationMetric/memoryLimitTerminationCount)

The number of times the system terminated the app from the foreground for using too much memory.

[`let badAccessTerminationCount: Int`](/documentation/MetricKit/ForegroundTerminationMetric/badAccessTerminationCount)

The number of times the system terminated the app from the foreground for attempting an invalid memory access.

[`let abnormalTerminationCount: Int`](/documentation/MetricKit/ForegroundTerminationMetric/abnormalTerminationCount)

The number of times the app terminated abnormally from the foreground.

[`let illegalInstructionTerminationCount: Int`](/documentation/MetricKit/ForegroundTerminationMetric/illegalInstructionTerminationCount)

The number of times the system terminated the app from the foreground for attempting to execute an illegal or undefined instruction.

[`let watchdogTerminationCount: Int`](/documentation/MetricKit/ForegroundTerminationMetric/watchdogTerminationCount)

The number of times the system watchdog terminated the app from the foreground.

## Relationships

### Conforms To

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

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

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

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

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

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

---

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)