Skip to content

Add support for Swift package manager #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 6, 2025

Conversation

EchoEllet
Copy link
Contributor

@EchoEllet EchoEllet commented Jun 2, 2025

Swift Package Manager support

Support for SPM has already been added to most Flutter plugins and was included in the stable release a while ago. Soon, support for CocoaPods will be deprecated and removed at some point. This PR doesn't remove support for CocoaPods and maintains backward compatibility.

The package macos_ui still depends on appkit_ui_element_colors, which doesn't support the Swift Package Manager yet, but the PR Adrian-Samoticha/appkit_ui_element_colors#2 should fix the issue.

The changes made in this PR follow the Flutter guide for plugin authors.

The example app has been tested with both CocoaPods and SPM. I also ran the following commands:

pod lib lint macos/macos_window_utils.podspec  --configuration=Debug --skip-tests --use-modular-headers --use-libraries
pod lib lint macos/macos_window_utils.podspec  --configuration=Debug --skip-tests --use-modular-headers
image

Related Issues

Other changes

This PR makes some other minor related changes:

  • Excluding Swift package manager files from version control.
  • Adding an empty privacy manifest file, most Flutter plugins have this, including url_launcher. This will become required even for macOS (see [various] Adds macOS privacy manifests flutter/packages#7687).
  • Adding Swift package manager integration for the example app, updating some files, and upgrading the Xcode project to run the macOS app.
  • Importing AppKit where needed, this is required by the Swift package manager to access macOS APIs such as NSWindow.
  • Example changes are fully automated when running flutter run -d macos.

@EchoEllet EchoEllet changed the title Add support for swift package manager Add support for Swift package manager Jun 2, 2025
@Adrian-Samoticha
Copy link
Member

This is immensely helpful as I haven’t yet had the time to familiarize myself with the Swift package manager. Thanks a lot; I will review both PRs soon. :)

@EchoEllet
Copy link
Contributor Author

EchoEllet commented Jun 4, 2025

familiarize myself with the Swift package manager

Reading Swift Package Manager for plugin authors by Flutter is usually enough. If you have questions regarding any change and why it was introduced, please let me know.

@Adrian-Samoticha Adrian-Samoticha merged commit 5a60ed5 into macosui:master Jun 6, 2025
@Adrian-Samoticha
Copy link
Member

Alright, I merged it. However, the same issue that’s present in macos_ui (that podfile being mentioned in the readme) is present here as well. I’ll open an issue about it.

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.

Swift Package Manager support
2 participants