Skip to content

feat: Add Swift Package Manager support for iOS and macOS#493

Open
vasu-nageshri-simform wants to merge 1 commit into
mainfrom
feat/swift-package-manager-support
Open

feat: Add Swift Package Manager support for iOS and macOS#493
vasu-nageshri-simform wants to merge 1 commit into
mainfrom
feat/swift-package-manager-support

Conversation

@vasu-nageshri-simform

@vasu-nageshri-simform vasu-nageshri-simform commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

Migrate plugin sources to SPM-compatible directory structure and add Package.swift for iOS and macOS with FlutterFramework dependency.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #492 #485 #484

@vasu-nageshri-simform vasu-nageshri-simform force-pushed the feat/swift-package-manager-support branch from e2922fe to cbd6e11 Compare June 10, 2026 10:32
@bbbshah

bbbshah commented Jun 12, 2026

Copy link
Copy Markdown

Thanks for tackling this — the overall approach is right: FlutterFramework package dependency, correct Sources/audio_waveforms/ layout, and the hyphenated audio-waveforms product name. A few things should be addressed before merge:

1. macOS: duplicate class + infinite recursion (build/runtime breaker).
On iOS you correctly deleted the Obj-C shim and renamed the Swift class to AudioWaveformsPlugin. On macOS the Obj-C shim was kept and the Swift class was renamed to the same name, so there are now two AudioWaveformsPlugin classes, and the shim registers itself:

+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
    [AudioWaveformsPlugin registerWithRegistrar:registrar]; // recurses into the Obj-C class
}

Please mirror the iOS change on macOS: delete include/audio_waveforms/AudioWaveformsPlugin.h and AudioWaveformsPlugin.m and rely on the Swift AudioWaveformsPlugin (pubspec already points macos.pluginClass at it). The publicHeadersPath/headerSearchPath entries in the macOS Package.swift can then be dropped.

2. Flutter SDK constraint is too low. The .package(name: "FlutterFramework", path: "../FlutterFramework") dependency is only generated by Flutter 3.44+. pubspec.yaml should be bumped to align with the official guidance (flutter: ">=3.41.0", sdk: ^3.11.0) rather than >=3.22.0, otherwise SwiftPM resolution fails on older SDKs.

3. iOS deployment target mismatch. Package.swift declares .iOS("13.0") but the podspec is set to 9.0. These should match — please set the podspec to :ios, '13.0'.

Migrate plugin sources to SPM-compatible directory structure and add
Package.swift for iOS and macOS with FlutterFramework dependency.
@vasu-nageshri-simform vasu-nageshri-simform force-pushed the feat/swift-package-manager-support branch 2 times, most recently from b93e36a to 8312000 Compare June 18, 2026 10:35
@bbbshah

bbbshah commented Jun 18, 2026

Copy link
Copy Markdown

Thanks @vasu-nageshri, the macOS shim removal and the deployment-target alignment look good.

One thing still outstanding on the SDK constraint: flutter: ">=3.24.0" is still below what this mechanism needs. The FlutterFramework package (.package(path: "../FlutterFramework")) is only generated by Flutter 3.44+; on 3.24–3.40 it doesn't exist, so SwiftPM resolution fails. Per the official guidance this should be flutter: ">=3.41.0" (and ideally sdk: ^3.11.0).

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.

Missing Swift Package Manager (SPM) support + Future Flutter compatibility warning

2 participants