Swiftpack.co -  Appracatappra/SwiftUiSharing as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Appracatappra/SwiftUiSharing
Provides a Sharing Sheet on iOS & iPadOS and a Sharing Menu on macOS in a SwiftUI fashion that allows the user to share a piece of data using the Sharing Options available on the device the app is running on.
.package(url: "https://github.com/Appracatappra/SwiftUiSharing.git", from: "1.01")

SwiftUiSharing for Swift and SwiftUI

Provides a Sharing Sheet on iOS & iPadOS and a Sharing Menu on macOS in a SwiftUI fashion that allows the user to share a piece of data using the Sharing Options available on the device the app is running on.

Installation

Swift Package Manager (Xcode 11 and above)

  1. Select File > Swift Packages > Add Package Dependency… from the File menu.
  2. Paste https://github.com/Appracatappra/SwiftUiSharing.git in the dialog box.
  3. Follow the Xcode's instruction to complete the installation.

Why not CocoaPods, or Carthage, or blank?

Supporting multiple dependency managers makes maintaining a library exponentially more complicated and time consuming.

Since, the Swift Package Manager is integrated with Xcode 11 (and greater), it's the easiest choice to support going further.

iOS Example

Here's an example of using SwiftUiSharing on iOS/iPadOS:

Button(action: {
    SharingSheet.openMarkdownPrintSheet(markdown: dataStore.allShoppingLists(asMarkdown:true), simpleText: dataStore.allShoppingLists(), fromX: 245.0, fromY: 32.0)
}) {
    Image(systemName: "square.and.arrow.up")
        .resizable()
        .foregroundColor(Color("AccentColor"))
}
.frame(width: 24.0, height: 24.0)
.help("Share your Shopping Lists")

Which looks like this on iOS:

Which looks like this on iPadOS:

macOS Example

Here's an example of using SwiftUiSharing on macOS:

CommandGroup(replacing: .newItem){
 NSSharingService.sharingMenu(title: "Share Shopping List") {
     return MasterDataStore.SharedDataStore.allShoppingLists()
 }
 
 Divider()
 
 ...
}

Which looks like this on macOS:

GitHub

link
Stars: 2
Last commit: 4 weeks 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.

Release Notes

1.0.5
4 weeks ago

Updated to latest SwiftletUtilities and added Unit Tests.

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