---
title: "texture(withContentsOf:options:queue:completionHandler:)"
framework: glkit
role: symbol
role_heading: Instance Method
path: "glkit/glktextureloader/texture(withcontentsof:options:queue:completionhandler:)-55187"
---

# texture(withContentsOf:options:queue:completionHandler:)

Asynchronously loads a 2D texture image from a URL and creates a new texture from the data.

## Declaration

```swift
func texture(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: dispatch_queue_t?, completionHandler block: @escaping @Sendable (GLKTextureInfo?, (any Error)?) -> Void)
```

```swift
func texture(withContentsOf url: URL, options: [String : NSNumber]? = nil, queue: dispatch_queue_t?) async throws -> GLKTextureInfo
```

## Parameters

- `url`: A URL to the file to load.
- `options`: A dictionary that describes any additional steps you want the texture loader to take when loading the texture. See doc://com.apple.glkit/documentation/GLKit/texture-loading-options.
- `queue`: A dispatch queue that your block is called on when the task completes. If NULL is passed, the block is called on the main dispatch queue.
- `block`: A block to be called when the task completes.

## Discussion

Discussion This method is identical to texture(withContentsOf:options:), except that it loads the texture asynchronously. When this method is called, it creates a new background task to handle the request and then returns control to your app. Later, when the task is complete, GLKit calls your completion handler on the queue you provided.

## See Also

### Loading a Texture From a URL

- [texture(withContentsOf:options:)](glkit/glktextureloader/texture(withcontentsof:options:)-708ft.md)
