---
title: "init(data:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uiimage/init(data:)"
---

# init(data:)

Initializes and returns the image object with the specified data.

## Declaration

```swift
init?(data: Data)
```

## Parameters

- `data`: The data object containing the image data.

## Return Value

Return Value An initialized UIImage object, or nil if the method could not initialize the image from the specified data.

## Discussion

Discussion The data in the data parameter must be formatted to match the file format of one of the system’s supported image types.

## See Also

### Creating and initializing image objects

- [init(contentsOfFile:)](uikit/uiimage/init(contentsoffile:).md)
- [init(data:scale:)](uikit/uiimage/init(data:scale:).md)
- [init(cgImage:)](uikit/uiimage/init(cgimage:)-14qlb.md)
- [init(cgImage:scale:orientation:)](uikit/uiimage/init(cgimage:scale:orientation:)-2ouhh.md)
- [init(ciImage:)](uikit/uiimage/init(ciimage:)-93vu1.md)
- [init(ciImage:scale:orientation:)](uikit/uiimage/init(ciimage:scale:orientation:)-9gpyn.md)
- [UIImageReader](uikit/uiimagereader-swift.struct.md)
