Swiftpack.co -  psalzAppDev/PSActivityImageViewController as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A UIActivityViewController to share images while displaying them as a nice preview.
.package(url: "https://github.com/psalzAppDev/PSActivityImageViewController.git", from: "1.1.1")



This view controller allows you to share an image the same way as a normal UIActivityViewController would, with one bonus: The image is actually shown on top of the UIActivityViewController with a nice blurred background.

You can add any items you want to share, but only the image is displayed.

A SwiftUI adaptation is also available, based on the excellent work in ActivityView.


These screenshots are taken from my app TwoSlideOver. Check it out here



  • image: The image you want to share and at the same time display as a preview.
  • activityItems: All the items you want to share, with the image included.
  • activities: Optional array of UIActivity
  • excludedTypes: Optional array of excluded activity types.
  • completion: An optional UIActivityViewController.CompletionWithItemsHandler to handle any code after completion.



import PSActivityImageViewController


let activityImageVC = ActivityImageViewController(
   image: someImage,
   activityItems: [someImage, self], // or just [someImage]
   completion: { activity, completed, _, error in

       if let error = error {
           print("Error: \(error.localizedDescription)")

       // Do something with the rest of the information.

// Important for iPad, as otherwise the app will crash!
activityImageVC.popoverPresentationController?.sourceView = someView
activityImageVC.popoverPresentationController?.sourceRect = someView.bounds

present(activityImageVC, animated: true)


import SwiftUI
import PSActivityImageViewController

struct ContentView: View {
    let image = Image("Image")
    var activityItem: ActivityImageItem? = nil
    var body: some View {
        VStack(spacing: 16) {
                .aspectRatio(contentMode: .fit)
                action: {
                    activityItem = ActivityImageItem(image: image)
                label: {
                    Text("Share image")


As is the case for UIActivityViewController, on iPad you need to specify the source for the popoverPresentationController.


Swift Package Manager

PSActivityImageViewController is available through Swift Package Manager.

Add it to an existing Xcode project as a package dependency:

  1. From the File menu, select Swift Packages › Add Package Dependency…
  2. Enter "https://github.com/psalzAppDev/PSActivityImageViewController" into the package repository URL text field


  • iOS 10.0+
  • Xcode 12+


PSActivityImageViewController is available under the MIT license. See the LICENSE file for more info.


Stars: 5
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

Added SwiftUI support.
1 week ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics