Skip to content

Conversation

@IwO30
Copy link

@IwO30 IwO30 commented Dec 1, 2025

Summary

This PR fixes Swift Package Manager (SPM) integration with Flutter's plugin system for workmanager_apple.

Problem

Flutter's SPM integration expects:

  1. Package.swift at ios/<plugin_name>/Package.swift (not directly in ios/)
  2. Product names with hyphens (e.g., workmanager-apple) not underscores (workmanager_apple)

Without these fixes, Flutter falls back to CocoaPods instead of using SPM, even when SPM is enabled.

Changes

  • 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

Testing

  • Tested with Flutter 3.24+ with SPM enabled (flutter config --enable-swift-package-manager)
  • iOS build succeeds without CocoaPods fallback
  • All 16 iOS plugins now use SPM exclusively

Related

This follows the same pattern as other Flutter plugins with SPM support (e.g., flutter-secure-storage-darwin, path-provider-foundation, etc.)


🤖 Generated with Claude Code

@docs-page
Copy link

docs-page bot commented Dec 1, 2025

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.
@IwO30 IwO30 force-pushed the fix/spm-product-name-and-structure branch from ab2369a to 5bf5585 Compare December 1, 2025 16:47
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.

1 participant