Skip to content

Add Swift Package Manager support #303

Open

Description

@abdallahshaban557

Hello,

Flutter is migrating to Swift Package Manager. Please add Swift Package Manager support to your plugin.

SwiftPM will be the default for all Flutter apps in the next stable release (3.44). To ensure your plugin remains compatible and prevents build failures for your users, please migrate to SwiftPM

Flutter will eventually deprecate and then remove support for CocoaPods. Adding Swift Package Manager support future-proofs your plugins.

How to add Swift Package Manager support to your plugins

You can find the migration guide here: https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-plugin-authors#how-to-add-swift-package-manager-support-to-an-existing-flutter-plugin

If you run into issues or have questions, please reach out to the Flutter team. You can send a message to the #hackers-ios channel on Flutter's discord or open a GitHub issue.

Thank you for your wonderful contributions to the Flutter ecosystem!

Why is Flutter migrating to Swift Package Manager?

CocoaPods is now in maintenance mode.

Swift Package Manager support is one of Flutter's most requested features: flutter#33850.

Flutter's Swift Package Manager integration has several benefits:

  1. Access to the Swift package ecosystem. Flutter plugins can use the growing ecosystem of Swift packages.
  2. Simplifies Flutter installation. Swift Package Manager is bundled with Xcode. In the future, you won't need to install Ruby and CocoaPods to target iOS or macOS.

Activity

  1. paoloartasensi commented on May 27, 2026

    @paoloartasensi

    Hi team,

    Adding our voice here as a project that depends on this plugin and is currently blocked by the missing SPM support.

    We migrated from the deprecated am15h/tflite_flutter_plugin and are using:

    tflite_flutter: ^0.12.1

    On every iOS build with Flutter 3.44.0 + Xcode 16.0 we get:

    The following plugins do not support Swift Package Manager for ios: tflite_flutter. This will become an error in a future version of Flutter.

    Our environment:

    • Flutter 3.44.0 (stable)
    • Xcode 16.0
    • macOS 14.8.3
    • iOS deployment target: 15.5

    Is there an estimated timeline for the SPM migration? Happy to help test any beta or PR.

    Thanks for your work on this plugin!

  2. kmmhanan commented on Jun 6, 2026

    @kmmhanan

    PR #305 Announcement

    Hi everyone,

    I've submitted PR #305 to address Flutter Kotlin capability issues and add Swift Package Manager (SPM) support for iOS/macOS.

    cc @PaulTR @am15h @knottx @enricostrijks @himanshudeveloper @guyluz11 @CaptainDario @BoHellgren @dewball345

    What it delivers

    • Critical fix: resolved Flutter Kotlin capability issues on Android
    • Critical fix: added Swift Package Manager (SPM) support for iOS/macOS
    • Moved plugin source files into ios/ and macos/ folders to enable proper SPM integration
    • Verified compatibility with Flutter 3.44.0

    Testing completed

    • Flutter Kotlin capability issues confirmed resolved on Android
    • SPM integration verified with plugin sources properly structured under ios/ and macOS/
    • Full compatibility confirmed with Flutter 3.44.0

    Current status

    PR #305 delivers both the Android Kotlin fix and iOS/macOS SPM support as a unified release (0.12.2). These are critical fixes that unblock developers hitting Kotlin capability errors on Android and SPM integration issues on Apple platforms.

    While PR #305 awaits merging, you can use the fixed version immediately via dependency_overrides in your pubspec.yaml:

    dependency_overrides:
      tflite_flutter:
        git:
          url: https://github.com/kmmhanan/flutter-tflite.git
          ref: v0.12.3

    Notes

    • This PR directly addresses long-standing Kotlin compatibility pain points on Android that have been affecting multiple users.
    • The SPM support aligns the plugin with modern Apple platform standards, enabling smoother integration for iOS and macOS projects.
    • The override above points to the author's fixed fork and will be removable once the PR is merged upstream.

    See [PR #305](#305) for technical details.

  3. jpdup commented on Jun 8, 2026

    @jpdup

    I approved this PR
    Tested/verified your PR #305 on our builds of iOS and macOS and Android

    The PR builds but does not actually works at runtime, heres the details:

    Logging is now in place. Now regarding the actual error — dlsym(RTLD_DEFAULT): symbol not found for 'TfLiteModelCreate' — this means the TensorFlowLiteC framework is not being linked into the iOS app. This is exactly the problem PR #305 was meant to fix via SPM. Let me check what that PR actually provides:
    
    Now the root cause is clear. PR #305 adds a stub Package.swift that just registers the Flutter channel — but it doesn't declare TensorFlowLiteC as a binary dependency. The CocoaPods version pulled in TensorFlowLiteSwift pod (which contains the C library). SPM has no equivalent yet, so TfLiteModelCreate is simply never linked into the iOS app.
    
    The PR fixes the SPM warning, but not the actual TFLite linkage on iOS.
    
  4. kmmhanan commented on Jun 8, 2026

    @kmmhanan

    Okay I'll check

  5. okdevy commented on Sep 16, 2026

    @okdevy

    Okay I'll check

    Hello, any updates on 0.12.3?

  6. kmmhanan commented on Sep 17, 2026

    @kmmhanan
    dependency_overrides:
      tflite_flutter:
        git:
          url: https://github.com/kmmhanan/flutter-tflite.git
          ref: v0.12.4

    use this bro, official package not available due to repo dead

  7. kmmhanan commented on Oct 16, 2026

    @kmmhanan

    tflite_flutter package is dead. I have forked and updated the tflite_flutter package.
    and added SPM support and fixed some extra bugs. also now this package even compatible for the new flutter versions as well.

    so u can use this package.

    tflite_core: ^0.12.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions