Skip to content

Add Swift Package Manager support for iOS - #9

Closed
TeddyYeung wants to merge 1 commit into
Alezhka:masterfrom
TeddyYeung:feat/swift-package-manager-support
Closed

TeddyYeung wants to merge 1 commit into
Alezhka:masterfrom
TeddyYeung:feat/swift-package-manager-support

Conversation

@TeddyYeung

Copy link
Copy Markdown

What

Adds Swift Package Manager support for the iOS implementation, alongside the existing CocoaPods podspec (no breaking change for current consumers).

Why

Flutter added first-class SPM support for plugins; apps that opt into flutter.plugin.platforms.ios Package.swift resolution can't currently pick this plugin up because there's no ios/flutter_mute/Package.swift.

How

  • Moved ios/Classes/* into ios/flutter_mute/Sources/flutter_mute/* (Flutter's documented federated-plugin SPM layout).
  • Public header moved to Sources/flutter_mute/include/flutter_mute/ and exposed via cSettings.headerSearchPath in Package.swift.
  • mute.aiff moved to Sources/flutter_mute/Resources and declared as an SPM .process() resource.
  • MuteDetect.swift now resolves the sound file via Bundle.module under #if SWIFT_PACKAGE, falling back to the original Bundle(for:) lookup for CocoaPods builds.
  • flutter_mute.podspec source_files/resources updated to the new paths — CocoaPods integration is otherwise unchanged.

Testing

Verified the file layout matches Flutter's official plugin SPM migration guide. I don't have a maintainer-side CI/example app to run a full flutter build ios against both resolution paths — please let me know if you'd like anything else checked before merging.

Restructure ios/Classes into ios/flutter_mute/Sources/flutter_mute per
Flutter's federated-plugin SPM layout and add Package.swift.

- Public header moved under Sources/flutter_mute/include/flutter_mute
  so it is discoverable via cSettings.headerSearchPath.
- mute.aiff moved under Sources/flutter_mute/Resources and declared as
  a processed SPM resource; MuteDetect looks it up via Bundle.module
  under SWIFT_PACKAGE, falling back to Bundle(for:) for CocoaPods.
- flutter_mute.podspec source_files/resources updated to the new paths;
  CocoaPods consumers are unaffected.
@TeddyYeung

Copy link
Copy Markdown
Author

Closing, since this repository is not accepting changes. This change and the fixes from #6 and #7 are published in flutter_mute_plus.

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