---
title: "withBorrowedName(body:)"
framework: System
role: symbol
role_heading: Instance Method
platforms: [iOS 17.4+, iPadOS 17.4+, Mac Catalyst 17.4+, macOS 14.4+, tvOS 17.4+, visionOS 1.0+, watchOS 10.4+]
path: "system/mach/port/withborrowedname(body:)-9v68k"
---

# 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) -> ReturnType) -> ReturnType
```

## Discussion

Discussion Take care when using this function; many operations consume rights, and send-once rights are easily consumed. 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.
