Skip to content

feat(desktop_multi_window): add Swift Package Manager support for macOS#482

Merged
boyan01 merged 1 commit into
MixinNetwork:mainfrom
tomassasovsky:feat/desktop-multi-window-spm-macos
Jun 22, 2026
Merged

feat(desktop_multi_window): add Swift Package Manager support for macOS#482
boyan01 merged 1 commit into
MixinNetwork:mainfrom
tomassasovsky:feat/desktop-multi-window-spm-macos

Conversation

@tomassasovsky

Copy link
Copy Markdown
Contributor

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:

The following plugins do not support Swift Package Manager for macos:

  • desktop_multi_window
    This will become an error in a future version of Flutter.

How

Follows the standard Flutter plugin SPM layout (same shape as the first-party *_foundation plugins):

  • Move macos/Classes/*.swiftmacos/desktop_multi_window/Sources/desktop_multi_window/.
  • Add macos/desktop_multi_window/Package.swift (swift-tools-version: 5.9, platforms: [.macOS("10.11")], matching the podspec's deployment target).
  • Repoint the podspec's source_files at 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

  • With 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 for desktop_multi_window is gone.
  • In a separate SPM-based host app, Flutter reports desktop_multi_window as a Swift Package.

Notes

  • Bumped to 0.3.1 + a CHANGELOG entry; happy to adjust the version to whatever you prefer.

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).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.swift and moved macOS Swift sources under Sources/desktop_multi_window/ for SwiftPM consumption.
  • Repointed the CocoaPods podspec source_files to 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.1 and 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"
)
]
)
@boyan01 boyan01 merged commit 5119508 into MixinNetwork:main Jun 22, 2026
1 check failed
@boyan01

boyan01 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

LGTM, thanks for the PR

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.

3 participants