Skip to content

Added SPM Support#463

Open
vicajilau wants to merge 3 commits intoMixinNetwork:mainfrom
vicajilau:feature/spm-support
Open

Added SPM Support#463
vicajilau wants to merge 3 commits intoMixinNetwork:mainfrom
vicajilau:feature/spm-support

Conversation

@vicajilau
Copy link
Contributor

This update adds support for the Pasteboard package in Swift Package Manager on both iOS and macOS. I have tested the integration on both iOS and macOS using CocoaPods and SPM.

…ackage Manager support, removing old plugin files, and update example project dependencies and macOS deployment target.
…anager, update Xcode scheme, and app delegate.
@vicajilau
Copy link
Contributor Author

I took the opportunity to correct the linter warnings using Flutter 3.41.

@acastanos
Copy link

Great PR! This update is crucial for Flutter compatibility. +1 for merging. Thx @vicajilau for the job

@crossle crossle requested review from boyan01 and Copilot and removed request for Copilot February 18, 2026 11:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Swift Package Manager (SPM) support for the pasteboard Flutter plugin on iOS and macOS, updating the native plugin structure and example apps to validate SPM-based integration (Issue #462).

Changes:

  • Introduces SwiftPM Package.swift manifests and Swift sources for iOS/macOS plugin targets.
  • Updates CocoaPods podspecs to compile the SwiftPM source layout (and removes the iOS Obj-C registrar shim).
  • Migrates the example iOS/macOS projects away from CocoaPods and updates project/scheme settings for SPM-based builds.

Reviewed changes

Copilot reviewed 22 out of 27 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/pasteboard/macos/pasteboard/Sources/pasteboard/PasteboardPlugin.swift New macOS Swift implementation for SPM/CocoaPods source layout.
packages/pasteboard/macos/pasteboard/Package.swift New macOS SwiftPM manifest for the plugin.
packages/pasteboard/macos/pasteboard.podspec Points CocoaPods at SwiftPM-style Sources/ Swift files.
packages/pasteboard/lib/src/pasteboard_platform_io.dart Refactors temp filename helper; Windows writeImage path touched.
packages/pasteboard/ios/pasteboard/Sources/pasteboard/SwiftPasteboardPlugin.swift Renames Swift plugin class to PasteboardPlugin to match pluginClass.
packages/pasteboard/ios/pasteboard/Package.swift New iOS SwiftPM manifest for the plugin.
packages/pasteboard/ios/pasteboard.podspec Points CocoaPods at SwiftPM-style Sources/ Swift files.
packages/pasteboard/ios/Classes/PasteboardPlugin.m Removes legacy Obj-C registrar shim (now handled via @objc(PasteboardPlugin)).
packages/pasteboard/ios/Classes/PasteboardPlugin.h Removes legacy Obj-C header for the registrar shim.
packages/pasteboard/example/pubspec.lock Updates example’s resolved Dart/Flutter dependency lockfile.
packages/pasteboard/example/macos/Runner/AppDelegate.swift Updates macOS app entry point to modern Swift @main + secure state support.
packages/pasteboard/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme Adds Flutter “prepare” pre-action and updates scheme settings for SPM workflows.
packages/pasteboard/example/macos/Runner.xcodeproj/project.pbxproj Migrates macOS example project from Pods to FlutterGeneratedPluginSwiftPackage + bumps deployment target.
packages/pasteboard/example/macos/Podfile.lock Removes CocoaPods lockfile from macOS example.
packages/pasteboard/example/macos/Podfile Removes CocoaPods Podfile from macOS example.
packages/pasteboard/example/macos/Flutter/Flutter-Release.xcconfig Removes Pods xcconfig include for macOS example.
packages/pasteboard/example/macos/Flutter/Flutter-Debug.xcconfig Removes Pods xcconfig include for macOS example.
packages/pasteboard/example/ios/Runner/Info.plist Updates iOS example Info.plist for newer Flutter/iOS project structure (scenes, etc.).
packages/pasteboard/example/ios/Runner/AppDelegate.swift Updates iOS example AppDelegate for implicit engine initialization registration flow.
packages/pasteboard/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme Adds Flutter “prepare” pre-action and updates scheme settings for SPM workflows.
packages/pasteboard/example/ios/Runner.xcodeproj/project.pbxproj Migrates iOS example project from Pods to FlutterGeneratedPluginSwiftPackage + bumps deployment target.
packages/pasteboard/example/ios/Podfile.lock Removes CocoaPods lockfile from iOS example.
packages/pasteboard/example/ios/Podfile Removes CocoaPods Podfile from iOS example.
packages/pasteboard/example/ios/Flutter/Release.xcconfig Removes Pods xcconfig include for iOS example.
packages/pasteboard/example/ios/Flutter/Debug.xcconfig Removes Pods xcconfig include for iOS example.
packages/pasteboard/example/ios/Flutter/AppFrameworkInfo.plist Removes explicit MinimumOSVersion entry from framework plist.
Comments suppressed due to low confidence (1)

packages/pasteboard/lib/src/pasteboard_platform_io.dart:73

  • On Windows, this async method uses blocking IO (writeAsBytesSync) and also calls file.delete() without awaiting the returned Future, which can leave temp files behind (and may trigger unawaited_futures lints).

Prefer await file.writeAsBytes(image) and await file.delete() (or explicitly mark the delete as unawaited if that’s intentional).

      final file = await File(_getTempFileName()).create();
      file.writeAsBytesSync(image);
      await _channel
          .invokeMethod<Object>('writeImage', {'fileName': file.path});
      file.delete();
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

let package = Package(
name: "pasteboard",
platforms: [
.iOS("9.0")
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This SPM manifest declares .iOS("9.0"), but the iOS example app in this PR is now set to IPHONEOS_DEPLOYMENT_TARGET = 13.0 and other iOS examples in the repo commonly target 11.0+. This mismatch can make it unclear what the intended supported iOS baseline is for SPM consumers.

Consider raising the SwiftPM minimum iOS version to match the repo’s current iOS baseline (or document why it intentionally remains lower).

Suggested change
.iOS("9.0")
.iOS("13.0")

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the fact that this is a repository that houses different packages, you should focus on the pasteboard folder. This is because the versions of other packages are independent. If you look at the Cocoapods version on iOS for pasteboard in main, it is set to iOS 9.0.

let package = Package(
name: "pasteboard",
platforms: [
.macOS("10.11")
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This SPM manifest declares .macOS("10.11"), but other SwiftPM-based macOS plugins in this repo (e.g. desktop_drop) declare 10.13+. Keeping this at 10.11 may be inconsistent with the repo’s supported macOS baseline and can complicate integration when combined with other plugins.

Consider aligning the minimum macOS version with the repo’s existing SwiftPM packages (likely 10.13 or higher).

Suggested change
.macOS("10.11")
.macOS("10.13")

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. If we look at the Cocoapods version on macOS for pasteboard in main, it is set to macOS 10.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Pasteboard package support to SPM for iOS and macOS

2 participants

Comments