feat(desktop_multi_window): add Swift Package Manager support for macOS#482
Merged
boyan01 merged 1 commit intoJun 22, 2026
Merged
Conversation
Flutter is migrating macOS/iOS plugins to Swift Package Manager and warns that
desktop_multi_window doesn't support it ("This will become an error in a future
version of Flutter"). This adds SPM support alongside the existing CocoaPods
podspec, following the standard Flutter plugin layout:
- Move macos/Classes/*.swift to
macos/desktop_multi_window/Sources/desktop_multi_window/.
- Add macos/desktop_multi_window/Package.swift (swift-tools 5.9, macOS 10.11).
- Point the podspec's source_files at the new location so CocoaPods builds the
same sources (no behaviour change for existing CocoaPods consumers).
Verified: with SPM enabled, the example app builds for macOS and Flutter reports
desktop_multi_window as a Swift Package (the prior "does not support Swift
Package Manager" warning is gone).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Swift Package Manager (SPM) support for the desktop_multi_window macOS plugin by introducing a standard SwiftPM package layout and relocating the macOS Swift sources so they can be built consistently via both SPM and CocoaPods. It also updates the example macOS project to work with Flutter’s SPM-based plugin integration and bumps the package version + changelog.
Changes:
- Added
macos/desktop_multi_window/Package.swiftand moved macOS Swift sources underSources/desktop_multi_window/for SwiftPM consumption. - Repointed the CocoaPods podspec
source_filesto the new Swift source location to keep CocoaPods building the same code. - Updated the example macOS Xcode project/scheme and lockfile for Flutter’s SPM plugin workflow; bumped to
0.3.1and added a changelog entry.
Reviewed changes
Copilot reviewed 6 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/desktop_multi_window/pubspec.yaml | Bumps plugin version to 0.3.1. |
| packages/desktop_multi_window/CHANGELOG.md | Documents the 0.3.1 SPM support change. |
| packages/desktop_multi_window/macos/desktop_multi_window/Package.swift | Adds the SwiftPM package definition for macOS. |
| packages/desktop_multi_window/macos/desktop_multi_window/Sources/desktop_multi_window/WindowConfiguration.swift | Adds configuration decoding/encoding used by the macOS implementation. |
| packages/desktop_multi_window/macos/desktop_multi_window/Sources/desktop_multi_window/WindowChannel.swift | Adds macOS window-channel routing/registration logic (now under SwiftPM sources). |
| packages/desktop_multi_window/macos/desktop_multi_window/Sources/desktop_multi_window/FlutterWindow.swift | Adds window wrapper + lifecycle notification forwarding under SwiftPM sources. |
| packages/desktop_multi_window/macos/desktop_multi_window/Sources/desktop_multi_window/FlutterMultiWindowPlugin.swift | Adds the macOS plugin implementation + window manager under SwiftPM sources. |
| packages/desktop_multi_window/macos/desktop_multi_window.podspec | Updates CocoaPods source_files to point at the new SwiftPM source tree. |
| packages/desktop_multi_window/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme | Adds the standard Flutter “prepare” pre-action for SPM builds. |
| packages/desktop_multi_window/example/macos/Runner.xcodeproj/project.pbxproj | Adds Swift package references required for Flutter’s generated plugin Swift package integration. |
| packages/desktop_multi_window/example/macos/Podfile.lock | Updates lockfile consistent with the example’s dependency resolution under SPM. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+18
| // swift-tools-version: 5.9 | ||
| import PackageDescription | ||
|
|
||
| let package = Package( | ||
| name: "desktop_multi_window", | ||
| platforms: [ | ||
| .macOS("10.11") | ||
| ], | ||
| products: [ | ||
| .library(name: "desktop-multi-window", targets: ["desktop_multi_window"]) | ||
| ], | ||
| dependencies: [], | ||
| targets: [ | ||
| .target( | ||
| name: "desktop_multi_window" | ||
| ) | ||
| ] | ||
| ) |
Contributor
|
LGTM, thanks for the PR |
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.
What
Adds Swift Package Manager (SPM) support for the macOS plugin, alongside the existing CocoaPods podspec.
Why
Flutter is migrating macOS/iOS plugins to Swift Package Manager. Projects that have adopted SPM currently get this warning when they depend on
desktop_multi_window:How
Follows the standard Flutter plugin SPM layout (same shape as the first-party
*_foundationplugins):macos/Classes/*.swift→macos/desktop_multi_window/Sources/desktop_multi_window/.macos/desktop_multi_window/Package.swift(swift-tools-version: 5.9,platforms: [.macOS("10.11")], matching the podspec's deployment target).source_filesat the new location so CocoaPods builds the exact same sources — no behaviour change for existing CocoaPods consumers.Linux and Windows are unaffected (they don't use SPM).
Verification
flutter config --enable-swift-package-manager, the example app builds for macOS (✓ Built ... flutter_multi_window_example.app), and the prior "does not support Swift Package Manager" warning fordesktop_multi_windowis gone.desktop_multi_windowas a Swift Package.Notes
0.3.1+ a CHANGELOG entry; happy to adjust the version to whatever you prefer.