Contents

captureImage(in:completionHandler:)

Declaration

class func captureImage(in rect: CGRect, completionHandler: (@Sendable (CGImage?, (any Error)?) -> Void)? = nil)
class func captureImage(in rect: CGRect) async throws -> CGImage

Parameters

  • rect:

    The rect for the region in points on the screen space for the screen shot, this is display agnostic and supports multiple displays

  • completionHandler:

    Is the handler that will deliver the screenshot to the client

Discussion

captureImageInRect:completionHandler:

this method returns an image containing the contents of the rectangle in points, specified in display space