When you want to present a share sheet to share an image, it isn't hard to figure out how to use
UIActivityViewController. All you need is to prepare an
UIImage or a
URL pointing to an image:
let controller = UIActivityViewController( activityItems: [image], applicationActivities: nil) present(controller, animated: true)
However, you won't see the "Save Image" option in the share sheet by default. The reason you don't see this option is unintuitive, but it actually requires the host app to have the permission writing to the photo library.
Since this action directly saves the image in user's photo library, you want to enable this convenient option. To do this, open your project's
Info.plist file, add a "Privacy - Photo Library Additions Usage Description", and give it a value like "Support saving images to the photo library".