fix(ios): complete SPM support for Flutter 3.44+#223
Open
david-nunes-leadtech wants to merge 1 commit into
Open
fix(ios): complete SPM support for Flutter 3.44+#223david-nunes-leadtech wants to merge 1 commit into
david-nunes-leadtech wants to merge 1 commit into
Conversation
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
This PR completes the iOS Swift Package Manager (SPM) integration for
map_launcher. SPM support was partially introduced in #205 (v4.1.0), but the plugin was still resolved via CocoaPods in SPM-enabled Flutter apps becausePackage.swiftwas missing the requiredFlutterFrameworkdependency introduced in Flutter 3.44.This change brings the plugin in line with the official Flutter SPM migration guide for plugin authors while preserving CocoaPods compatibility for apps that have not migrated yet.
Motivation
Starting with Flutter 3.44, Swift Package Manager is the default iOS dependency manager. Plugins that do not fully support SPM:
After auditing the current setup,
map_launcherhad a validPackage.swiftand SPM directory layout, but Flutter still installed the plugin through CocoaPods becauseFlutterFrameworkwas not declared as a package dependency.What changed
Plugin (
ios/)ios/map_launcher/Package.swiftFlutterFrameworkpackage and target dependency (required since Flutter 3.44)ios/map_launcher/Package.swift.process("PrivacyInfo.xcprivacy")for SPM resource bundlingios/map_launcher.podspecresource_bundlesforPrivacyInfo.xcprivacy(CocoaPods parity)ios/.gitignore.build/and.swiftpm/Example app (
example/)example/pubspec.yamlflutter.config.enable-swift-package-manager: trueexample/ios/RunnerTests/RunnerTests.swiftgetPlatformVersiontest withisMapAvailablefor Apple Mapsexample/ios/Runner/AppDelegate.swiftFlutterImplicitEngineDelegate(UIScene lifecycle, Flutter 3.44)example/ios/Runner/Info.plistUIApplicationSceneManifestfor UIScene lifecycleexample/ios/Runner.xcodeproj/project.pbxprojmap_launcherandFlutterFrameworkexample/ios/Flutter/AppFrameworkInfo.plistMinimumOSVersionkey (Flutter 3.44 template).fvmrc3.44.4Before / After
Before
Package.swiftexisted but lackedFlutterFrameworkmap_launchervia CocoaPods even in SPM-enabled projectsFlutterGeneratedPluginSwiftPackagewas generated with an emptydependenciesarrayAfter
map_launcheras a Swift PackageFlutterGeneratedPluginSwiftPackageasmap-launchermap_launcher.podspecCompatibility
FlutterGeneratedPluginSwiftPackagemap_launcher.podspecpointing to the sameios/map_launcher/Sources/treeTesting
Validated locally with Flutter 3.44.4:
flutter pub getflutter build ios --config-only— plugin detected as Swift Package (no "does not support Swift Package Manager" warning)flutter build ios --no-codesign --release— example app builds successfully (Runner.app, ~17 MB)map_launcherappears in generatedFlutterGeneratedPluginSwiftPackage/Package.swiftPodfileremoved afterpod deintegrate)pod lib lintpasses with pre-existing metadata warnings unrelated to this change)Suggested maintainer verification
cd example flutter pub get flutter build ios --config-only flutter build ios --no-codesign --releaseNotes for reviewers
ios/Flutter/ephemeral/Packages/.packages/FlutterFramework. This is expected behavior in Flutter 3.44+..process) and CocoaPods (resource_bundles) paths.