feat(social_share): add Swift Package Manager support - #1
Merged
Conversation
Convert the appinio_social_share iOS plugin to support Swift Package Manager alongside CocoaPods, per the Flutter SwiftPM migration guide. - Add ios/appinio_social_share/Package.swift depending on FlutterFramework and the facebook-ios-sdk (FacebookCore + FacebookShare, pinned to 17.0.2) - Move Swift sources from ios/Classes to the SwiftPM target layout - Fold the Objective-C registration shim into the Swift plugin class (rename SwiftAppinioSocialSharePlugin -> AppinioSocialSharePlugin, exposed via @objc) since SwiftPM targets are single-language - Add explicit Flutter/UIKit imports to ShareUtil.swift - Update the podspec source_files path and bump the deployment target to iOS 12 to match the Facebook SDK - Ignore .build/ and .swiftpm/ Verified with both an SwiftPM build (flutter build ios) and a CocoaPods lint (pod lib lint). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR migrates the appinio_social_share iOS implementation to support Swift Package Manager (alongside CocoaPods), aligning the plugin structure with Flutter’s SwiftPM guidance and updating the example iOS app/project files for Flutter 3.44.2’s SwiftPM/scene lifecycle changes.
Changes:
- Added an iOS SwiftPM
Package.swiftand relocated plugin Swift sources intoios/appinio_social_share/Sources/.... - Removed the Objective-C registration shim and renamed the Swift plugin class to
AppinioSocialSharePluginwith@objc(...)exposure for Flutter registration. - Updated CocoaPods podspec paths + iOS deployment target, and adjusted the example app’s iOS workspace/project to integrate SwiftPM.
Reviewed changes
Copilot reviewed 16 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/appinio_social_share/ios/Classes/AppinioSocialSharePlugin.m | Removes Obj-C registration shim (Swift-only target compatibility). |
| packages/appinio_social_share/ios/Classes/AppinioSocialSharePlugin.h | Removes Obj-C header for the deprecated shim. |
| packages/appinio_social_share/ios/appinio_social_share/Sources/appinio_social_share/ShareUtil.swift | Adds explicit imports needed under SwiftPM compilation. |
| packages/appinio_social_share/ios/appinio_social_share/Sources/appinio_social_share/MyActivityItemSource.swift | Introduces a new UIActivityItemSource helper for richer share sheet metadata. |
| packages/appinio_social_share/ios/appinio_social_share/Sources/appinio_social_share/AppinioSocialSharePlugin.swift | Renames and re-exposes the plugin class for SwiftPM + Flutter registrant compatibility. |
| packages/appinio_social_share/ios/appinio_social_share/Package.swift | Adds SwiftPM manifest for the plugin (FlutterFramework + Facebook SDK). |
| packages/appinio_social_share/ios/appinio_social_share.podspec | Updates CocoaPods file glob + bumps iOS platform to 12.0. |
| packages/appinio_social_share/example/pubspec.lock | Updates resolved Dart/Flutter transitive deps for the example. |
| packages/appinio_social_share/example/ios/Runner/Info.plist | Updates example Info.plist for scene-based lifecycle. |
| packages/appinio_social_share/example/ios/Runner/AppDelegate.swift | Updates example AppDelegate for implicit engine initialization registration. |
| packages/appinio_social_share/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved | Adds SwiftPM resolution state for the workspace. |
| packages/appinio_social_share/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme | Adds pre-build action to prepare Flutter frameworks for SwiftPM integration. |
| packages/appinio_social_share/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved | Adds SwiftPM resolution state for the project workspace. |
| packages/appinio_social_share/example/ios/Runner.xcodeproj/project.pbxproj | Integrates Flutter SwiftPM packages and related build settings into the Xcode project. |
| packages/appinio_social_share/example/ios/Podfile.lock | Updates lockfile to reflect the new dependency integration approach. |
| packages/appinio_social_share/example/ios/Flutter/AppFrameworkInfo.plist | Adjusts framework plist entries as part of Flutter template/migration changes. |
| packages/appinio_social_share/.gitignore | Ignores SwiftPM build metadata directories. |
| .vscode/settings.json | Updates local Flutter SDK path (FVM) to 3.44.2. |
| .fvmrc | Pins Flutter version to 3.44.2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Converts the
appinio_social_shareiOS plugin to support Swift Package Manager alongside CocoaPods, following the Flutter SwiftPM migration guide for plugin authors. Also includes the priorchore: update to flutter 3.44.2commit.Changes
SwiftPM package (
ios/appinio_social_share/)Package.swift(swift-tools 5.9, iOS 12.0) depending onFlutterFrameworkandfacebook-ios-sdk(FacebookCore+FacebookShareproducts, pinned toexact: 17.0.2)ios/Classes/→ios/appinio_social_share/Sources/appinio_social_share/Mixed Objective-C + Swift → pure Swift (SwiftPM targets are single-language)
AppinioSocialSharePlugin.h/.m)SwiftAppinioSocialSharePlugin→AppinioSocialSharePlugin, exposed via@objc(AppinioSocialSharePlugin)so Flutter's generated registrant still resolves it (nopluginClasschange needed)import Flutter/import UIKittoShareUtil.swift(previously relied on CocoaPods' implicit cross-file module visibility)CocoaPods (kept working in parallel)
appinio_social_share.podspec: updatedsource_filespath; bumpeds.platform9.0→12.0to match the Facebook SDKMisc
.gitignore: added.build/and.swiftpm/Verification
flutter build ios --no-codesign→✓ Built Runner.app; Flutter reports "All plugins found for ios are Swift Packages."pod lib lint ios/appinio_social_share.podspec --use-libraries --use-modular-headers→ passed validation (only pre-existing/unrelated warnings)🤖 Generated with Claude Code