Swiftpack.co - LeoNatan/LNExtensionExecutor as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by LeoNatan.
LeoNatan/LNExtensionExecutor 1.2
An extension executor for iOS, allowing bypass of UIActivityViewController to execute both UI and non-UI action extensions.
⭐️ 45
🕓 1 year ago
iOS
.package(url: "https://github.com/LeoNatan/LNExtensionExecutor.git", from: "1.2")

LNExtensionExecutor

An extension executor for iOS, allowing bypass of UIActivityViewController to execute both UI and non-UI action extensions directly.

GitHub release GitHub stars GitHub license PayPal Donation Button

GitHub issues GitHub contributors

Adding to Your Project

Swift Package Manager is the recommended way to integrate LNExtensionExecutor in your project.

LNExtensionExecutor supports SPM versions 5.1.0 and above. To use SPM, you should use Xcode 11 to open your project. Click File -> Swift Packages -> Add Package Dependency, enter https://github.com/LeoNatan/LNExtensionExecutor. Select the version you’d like to use.

You can also manually add the package to your Package.swift file:

.package(url: "https://github.com/LeoNatan/LNExtensionExecutor.git", from: "1.0")

And the dependency in your target:

.target(name: "BestExampleApp", dependencies: ["LNExtensionExecutor"]),

Usage

In the following example, the WhatsApp share extension is opened with an image:

import LNExtensionExecutor

//...

do {
	let executor = try LNExtensionExecutor(extensionBundleIdentifier: "net.whatsapp.WhatsApp.ShareExtension")
	let (completed, returnItems) = try await executor.execute(withActivityItems: activityItems, on: self)
	print("completed: \(completed) return items: \(returnItems)")
} catch(let error) {
	print("error: \(error.localizedDescription)")
}

The activity items provided to the execute method should be the same that would be passed to a UIActivityViewController instance.

Extension Bundle Identifier Discovery

It is up to you to figure out what the bundle identifier of the extension is. One approach to discovering them is by using UIActivityViewController and setting the completionWithItemsHandler property with a closure, and printing the activityType argument. Note, that, in some cases, the activity type differs from the bundle identifier of the extension. Another approach is to obtain an IPA from the App Store or accessing the filesystem in a jailbroken device, and inspecting the Info.plist of the extension for the bundle identifier.

GitHub

link
Stars: 45
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

v1.2
1 year ago
  • Modernized API
  • Updated README

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