Skip to content

Migrate iOS plugin to Swift Package Manager#28

Open
elitree wants to merge 1 commit into
javaherisaber:masterfrom
elitree:feat/swift-package-manager-migration
Open

Migrate iOS plugin to Swift Package Manager#28
elitree wants to merge 1 commit into
javaherisaber:masterfrom
elitree:feat/swift-package-manager-migration

Conversation

@elitree

@elitree elitree commented Jun 9, 2026

Copy link
Copy Markdown

Context

CocoaPods is entering maintenance mode toward the end of the year, and Flutter now provides first-class Swift Package Manager support along with documentation for plugin authors on migrating. This PR adopts SPM ahead of that transition so the plugin keeps working smoothly as the ecosystem moves off CocoaPods.

Summary

Adds Swift Package Manager (SPM) support to the iOS plugin following Flutter's recommended dual-support approach — the plugin now ships an SPM package and keeps a working podspec, so it builds whether or not the consuming app has SPM enabled. No breaking changes for existing CocoaPods users.

Changes

Plugin

  • Restructured iOS sources into the SPM layout (history preserved via git mv):
    • ios/Classes/OpenFilePlugin.mios/open_filex/Sources/open_filex/OpenFilePlugin.m
    • ios/Classes/OpenFilePlugin.hios/open_filex/Sources/open_filex/include/open_filex/OpenFilePlugin.h (public headers under include/)
  • Added ios/open_filex/Package.swift — Objective-C target with .headerSearchPath("include/open_filex"), swift-tools-version: 5.9
  • Updated ios/open_filex.podspec to point source_files / public_header_files at the new paths (CocoaPods still works)
  • Bumped iOS deployment target 8.013.0 (Flutter's current enforced minimum)
  • Added .build/ to ios/.gitignore

Example app

  • Xcode project updated with the FlutterGeneratedPluginSwiftPackage reference and deployment target → 13.0
  • .gitignore gained .build/ and .swiftpm/
  • Includes the Flutter UIScene-lifecycle project migration (AppDelegate.swift, Info.plist) that Flutter applies on build — kept intentionally so the example builds cleanly on current Flutter

Testing

  • flutter build ios --simulator --no-codesign passes with Swift Package Manager enabled; build log confirms "Adding Swift Package Manager integration" and the plugin resolves through Package.swift.
  • CocoaPods path remains intact via the updated podspec.

@Ahmadgnoor

Copy link
Copy Markdown

Hello
how are you.?

when this will be published to pub dev....?

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.

2 participants