---
title: "extendLifetime(_:)"
framework: swift
role: symbol
role_heading: Function
path: "swift/extendlifetime(_:)"
---

# extendLifetime(_:)

Extends the lifetime of the given instance.

## Declaration

```swift
func extendLifetime<T>(_ x: borrowing T) where T : ~Copyable, T : ~Escapable
```

## Parameters

- `x`: An instance to preserve until this function returns.

## See Also

### Reference Counting

- [Unmanaged](swift/unmanaged.md)
- [withExtendedLifetime(_:_:)](swift/withextendedlifetime(_:_:)-4mmpv.md)
- [withExtendedLifetime(_:_:)](swift/withextendedlifetime(_:_:)-59dz3.md)
