---
title: "withUnsafePointer"
description: "Swift documentation for 'withUnsafePointer'"
layout: "default"
keywords: ""
root: "/v5.1"
---

<div class="intro-declaration"><code class="language-swift">func withUnsafePointer(to:_:)(to value: T, _ body: (UnsafePointer&lt;T>) throws -> Result) rethrows -> Result</code></div><div class="discussion comment"><p>Invokes the given closure with a pointer to the given argument.
</p>
<p>The <code>withUnsafePointer(to:_:)</code> function is useful for calling Objective-