<!--
{
  "availability" : [
    "macOS: 15.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextPreview/init(snapshotImage:presentationFrame:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextPreview(im)initWithSnapshotImage:presentationFrame:"
  },
  "title" : "init(snapshotImage:presentationFrame:)"
}
-->

# init(snapshotImage:presentationFrame:)

Creates a text preview using the specified image.

```
convenience init(snapshotImage: CGImage, presentationFrame: NSRect)
```

## Parameters

`snapshotImage`

An image that contains the requested text from your view.
Create the image using a transparent background and the current rendering
attributes for your text.

`presentationFrame`

A rectangle in your frame’s coordinate space. The
system uses this rectangle to place your image precisely over your view’s
actual text. Set its size to the size of your snapshot image, and set its
origin to the point that allows the system to place your image directly over the text.

---

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)