---
title: "withBorrowedName(body:)"
framework: System
role: symbol
role_heading: Instance Method
platforms: [macOS 14.4+]
path: "system/mach/port/withborrowedname(body:)-4d4iq"
---

# withBorrowedName(body:)

Borrow access to the port name in a block that can perform non-consuming operations.

## Declaration

```swift
func withBorrowedName<ReturnType>(body: (mach_port_name_t, mach_port_context_t) -> ReturnType) -> ReturnType
```

## Discussion

Discussion Take care when using this function; many operations consume rights. If the right is consumed, behavior is undefined. The body block may optionally return something, which will then be returned to the caller of withBorrowedName.
