---
name: "SDL_Metal_CreateView"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_Metal_CreateView"
---

# SDL\_Metal\_CreateView(3)

Create a CAMetalLayer-backed NSView/UIView and attach it to the specified window.

## NAME

SDL\_Metal\_CreateView - Create a CAMetalLayer-backed NSView/UIView and attach it to the specified window.

## HEADER FILE

Defined in SDL3/SDL\_metal.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**SDL\_MetalView SDL\_Metal\_CreateView(SDL\_Window \*window);**

## DESCRIPTION

On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on its own. It is up to user code to do that.

The returned handle can be casted directly to a NSView or UIView. To access the backing CAMetalLayer, call  **SDL\_Metal\_GetLayer** ().

## FUNCTION PARAMETERS

- *window*

  the window.

## RETURN VALUE

( **SDL\_MetalView** ) Returns handle NSView or UIView.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_Metal\_DestroyView**(3)](/SDL_Metal_DestroyView/3.md), **•**(3), [**SDL\_Metal\_GetLayer**(3)](/SDL_Metal_GetLayer/3.md)
