Migrate iOS plugin to Swift Package Manager - #28
Conversation
|
Hello when this will be published to pub dev....? |
Apply PR javaherisaber#28 (elitree) for Swift Package Manager support: - Add Package.swift with Obj-C target - Move source files to SPM layout - Update podspec paths (backward compatible) - Set iOS deployment target to 15.0 Co-Authored-By: elitree <elitree@users.noreply.github.com>
|
Any update on it ? Too much time in Review ??? |
|
@elitree Any Update? |
|
@javaherisaber please migrate the iOS plugin to Swift Package Manager (SwiftPM) as soon as possible. Flutter has now made Swift Package Manager the default approach for managing iOS/macOS native dependencies starting with Flutter 3.44, while CocoaPods is being maintained mainly for backward compatibility. Flutter is also recommending that plugin authors add SwiftPM compatibility as soon as possible. This migration will help ensure compatibility with upcoming Flutter versions and avoid future dependency/build issues related to the legacy CocoaPods-based setup. Please prioritize the migration when possible. |
|
Use |
|
@Ahmadgnoor thanks |
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
git mv):ios/Classes/OpenFilePlugin.m→ios/open_filex/Sources/open_filex/OpenFilePlugin.mios/Classes/OpenFilePlugin.h→ios/open_filex/Sources/open_filex/include/open_filex/OpenFilePlugin.h(public headers underinclude/)ios/open_filex/Package.swift— Objective-C target with.headerSearchPath("include/open_filex"),swift-tools-version: 5.9ios/open_filex.podspecto pointsource_files/public_header_filesat the new paths (CocoaPods still works)8.0→13.0(Flutter's current enforced minimum).build/toios/.gitignoreExample app
FlutterGeneratedPluginSwiftPackagereference and deployment target → 13.0.gitignoregained.build/and.swiftpm/AppDelegate.swift,Info.plist) that Flutter applies on build — kept intentionally so the example builds cleanly on current FlutterTesting
flutter build ios --simulator --no-codesignpasses with Swift Package Manager enabled; build log confirms "Adding Swift Package Manager integration" and the plugin resolves throughPackage.swift.