<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Never",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s5NeverO"
  },
  "title" : "Never"
}
-->

# Never

A type that has no values and can’t be constructed.

```
@frozen enum Never
```

## Overview

Use `Never` as the return type of a function
that doesn’t return normally — for example,
because it runs forever or terminates the program.

```
// An infinite loop never returns.
func forever() -> Never {
    while true {
        print("I will print forever.")
    }
}

// Calling fatalError(_:file:line:) unconditionally stops the program.
func crashAndBurn() -> Never {
    fatalError("Something very, very bad happened")
}
```

A function that returns `Never` is called a *nonreturning* function.
Closures, methods, computed properties, and subscripts
can also be nonreturning.

There’s no way to create an instance of `Never`;
this characteristic makes it an *uninhabited* type.
You can use an uninhabited type like `Never`
to represent states in your program
that are impossible to reach during execution.
Swift’s type system uses this information —
for example, to reason about control statements
in cases that are known to be unreachable.

```
let favoriteNumber: Result<Int, Never> = .success(42)
switch favoriteNumber {
case .success(let value):
    print("My favorite number is", value)
}
```

In the code above,
`favoriteNumber` has a failure type of `Never`,
indicating that it always succeeds.
The switch statement is therefore exhaustive,
even though it doesn’t contain a `.failure` case,
because that case could never be reached.

## Relationships

### Conforms To

[`DynamicInstructions`](/documentation/FoundationModels/DynamicInstructions)

[`Content`](/documentation/CoreMedia/CMSampleBuffer/Content)

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

[`CustomHoverEffect`](/documentation/SwiftUI/CustomHoverEffect)

[`AtomicRepresentable`](/documentation/Synchronization/AtomicRepresentable)

[`ControlWidgetConfiguration`](/documentation/SwiftUI/ControlWidgetConfiguration)

[`Generable`](/documentation/FoundationModels/Generable)

[`AxisMark`](/documentation/Charts/AxisMark)

[`Chart3DContent`](/documentation/Charts/Chart3DContent)

[`ShapeStyle`](/documentation/SwiftUI/ShapeStyle)

[`MapContent`](/documentation/MapKit/MapContent)

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

[`CoordinateSpace3D`](/documentation/Spatial/CoordinateSpace3D)

[`AppExtensionScene`](/documentation/ExtensionKit/AppExtensionScene)

[`ImmersiveSpaceContent`](/documentation/SwiftUI/ImmersiveSpaceContent)

[`AttachmentContent`](/documentation/RealityKit/AttachmentContent)

[`SceneAccessoryContent`](/documentation/SwiftUI/SceneAccessoryContent)

[`Plottable`](/documentation/Charts/Plottable)

[`View`](/documentation/SwiftUI/View)

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

[`ParameterSummary`](/documentation/AppIntents/ParameterSummary)

[`Scene`](/documentation/SwiftUI/Scene)

[`Transferable`](/documentation/CoreTransferable/Transferable)

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

[`TableRowContent`](/documentation/SwiftUI/TableRowContent)

[`TransferRepresentation`](/documentation/CoreTransferable/TransferRepresentation)

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

[`ConvertibleFromGeneratedContent`](/documentation/FoundationModels/ConvertibleFromGeneratedContent)

[`WidgetConfiguration`](/documentation/SwiftUI/WidgetConfiguration)

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

[`CoordinateSpace3DFloat`](/documentation/Spatial/CoordinateSpace3DFloat)

[`IntentValueConvertible`](/documentation/AppIntents/IntentValueConvertible)

[`Commands`](/documentation/SwiftUI/Commands)

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

[`CompositorContent`](/documentation/SwiftUI/CompositorContent)

[`ToolbarContent`](/documentation/SwiftUI/ToolbarContent)

[`ChartContent`](/documentation/Charts/ChartContent)

[`ReportableMetadata`](/documentation/StateReporting/ReportableMetadata)

[`InstructionsRepresentable`](/documentation/FoundationModels/InstructionsRepresentable)

[`PromptRepresentable`](/documentation/FoundationModels/PromptRepresentable)

[`AxisContent`](/documentation/Charts/AxisContent)

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

[`PrimitivePlottableProtocol`](/documentation/Charts/PrimitivePlottableProtocol)

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

[`ControlWidgetTemplate`](/documentation/SwiftUI/ControlWidgetTemplate)

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

[`MapSelectable`](/documentation/MapKit/MapSelectable)

[`CustomizableToolbarContent`](/documentation/SwiftUI/CustomizableToolbarContent)

[`Gesture`](/documentation/SwiftUI/Gesture)

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

[`PersistentlyIdentifiable`](/documentation/AppIntents/PersistentlyIdentifiable)

[`IntentResult`](/documentation/AppIntents/IntentResult)

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

[`DynamicProfile`](/documentation/FoundationModels/LanguageModelSession/DynamicProfile)

[`TestScoping`](/documentation/Testing/TestScoping)

[`AppIntent`](/documentation/AppIntents/AppIntent)

[`ConvertibleToGeneratedContent`](/documentation/FoundationModels/ConvertibleToGeneratedContent)

[`IntentValueExpressing`](/documentation/AppIntents/IntentValueExpressing)

[`StoreContent`](/documentation/StoreKit/StoreContent)

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

[`Keyframes`](/documentation/SwiftUI/Keyframes)

[`AccessibilityRotorContent`](/documentation/SwiftUI/AccessibilityRotorContent)

[`TableColumnContent`](/documentation/SwiftUI/TableColumnContent)

---

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)