Contents

writeImage(toSavedPhotosAlbum:orientation:completionBlock:)

Saves a given image to the Saved Photos album.

Declaration

func writeImage(toSavedPhotosAlbum imageRef: CGImage!, orientation: ALAssetOrientation, completionBlock: (@Sendable (URL?, (any Error)?) -> Void)!)
func writeImage(toSavedPhotosAlbum imageRef: CGImage!, orientation: ALAssetOrientation) async throws -> URL?

Parameters

  • imageRef:

    The image to save to the Saved Photos album.

  • orientation:

    The orientation at which to save the image.

  • completionBlock:

    The block invoked after the save operation completes.

    For a description of the block, see Alassetslibrarywriteimagecompletionblock.

Discussion

If you want to save a UIImage object, you can use the UIImage method cgImage to get a CGImageRef, and cast the image’s imageOrientation to ALAssetOrientation.

See Also

Saving Assets