---
title: "init(named:bundle:)"
framework: modelio
role: symbol
role_heading: Initializer
path: "modelio/mdltexture/init(named:bundle:)"
---

# init(named:bundle:)

Loads the texture with the specified filename from the specified bundle.

## Declaration

```swift
convenience init?(named name: String, bundle bundleOrNil: Bundle?)
```

## Parameters

- `name`: The name, including extension, of the image file to load as a texture.
- `bundleOrNil`: The bundle the image file is located in, or nil to use the main bundle.

## Return Value

Return Value A new texture object for the specified image file, or nil if no such file exists.

## Discussion

Discussion Calling this method immediately loads image data from the specified file. To instead create a texture object referencing a file and defer loading image data, use the MDLURLTexture class. This method does not cache the texture objects it creates; calling this method again with the same name parameter as a previous call will load image data from the file again.

## See Also

### Loading Textures from a Bundle

- [init(named:)](modelio/mdltexture/init(named:).md)
- [init(cubeWithImagesNamed:)](modelio/mdltexture/init(cubewithimagesnamed:).md)
- [init(cubeWithImagesNamed:bundle:)](modelio/mdltexture/init(cubewithimagesnamed:bundle:).md)
