fix(workmanager_apple): Correct SPM structure and product name for Flutter compatibility#657
Conversation
|
To view this pull requests documentation preview, visit the following URL: docs.page/fluttercommunity/flutter_workmanager~657 Documentation is deployed and generated using docs.page. |
…utter compatibility - Move Package.swift to ios/workmanager_apple/ subdirectory (Flutter SPM requirement) - Rename product from 'workmanager_apple' to 'workmanager-apple' (Flutter naming convention) - Add missing UIKit import in Extensions.swift for UIBackgroundFetchResult - Move Sources, Resources, Assets to correct subdirectory This fixes Swift Package Manager integration with Flutter's SPM plugin system, which expects: 1. Package.swift at ios/<plugin_name>/Package.swift 2. Product names with hyphens (e.g., 'workmanager-apple' not 'workmanager_apple') Without these fixes, Flutter falls back to CocoaPods instead of using SPM.
ab2369a to
5bf5585
Compare
|
Bump, could we merge this ? |
|
I am still getting a warning after implementing this PR as my workmanager dependency that workmanager_apple doesn't support SPM |
|
@martin-ideeri I'd love to, but I don't have merge rights on this repo — this needs a maintainer to merge. From my side it's ready: all checks pass and there are no conflicts with the base branch. |
|
@patrikbadanjak The structure in this PR is correct — it matches Flutter's own federated plugins (e.g. The umbrella You have to override dependency_overrides:
workmanager:
git:
url: https://github.com/IwO30/flutter_workmanager.git
ref: fix/spm-product-name-and-structure
path: workmanager
workmanager_apple:
git:
url: https://github.com/IwO30/flutter_workmanager.git
ref: fix/spm-product-name-and-structure
path: workmanager_appleThen: Could you confirm whether you had |
Summary
This PR fixes Swift Package Manager (SPM) integration with Flutter's plugin system for
workmanager_apple.Problem
Flutter's SPM integration expects:
Package.swiftatios/<plugin_name>/Package.swift(not directly inios/)workmanager-apple) not underscores (workmanager_apple)Without these fixes, Flutter falls back to CocoaPods instead of using SPM, even when SPM is enabled.
Changes
ios/workmanager_apple/subdirectory (Flutter SPM requirement)workmanager_appletoworkmanager-apple(Flutter naming convention)UIBackgroundFetchResultTesting
flutter config --enable-swift-package-manager)Related
This follows the same pattern as other Flutter plugins with SPM support (e.g.,
flutter-secure-storage-darwin,path-provider-foundation, etc.)