<!--
{
  "availability" : [
    "macOS: 10.5.0 - 11.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSImage/init(iconRef:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSImage(im)initWithIconRef:"
  },
  "title" : "init(iconRef:)"
}
-->

# init(iconRef:)

Initializes the image object with a Carbon-style icon resource.

```
convenience init(iconRef: IconRef)
```

## Parameters

`iconRef`

A reference to a Carbon icon resource.

## Return Value

An initialized `NSImage` object.

## Discussion

Creates one or more bitmap image representations, one for each size icon contained in the `IconRef` data structure. This initialization method automatically retains the data in the `iconRef` parameter and loads the bitmaps from that data file lazily.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)