Search code examples
swiftuiviewuiimagecalayer

Does Apple have a way to copy one view's appearance (i.e. what you physically see on screen) into an image buffer?


We have a UIView that, when tapped, we want a 'copy' of what appears on screen to simultaneously move up, grow and fade out as a visual cue that the user tapped on that particular item. Think of it as similar to 'liking' something on a site to give it a little visual flair. Does Apple have any built-in way to retrieve a copy of what visually appears on the screen into an image?


Solution

  • Yes, it’s called a snapshot view.

    https://developer.apple.com/documentation/uikit/uiview/1622531-snapshotview