Skip to content

[SwiftPM] Xcode build does not update the generated package's supported platforms #162196

@loic-sharma

Description

@loic-sharma

Problem

When using SwiftPM, the Flutter tool generates a Package.swift file that adds plugins to the app's builds. This Package.swift's supported platforms should match the Xcode project's Minimum Deployments.

However, if in Xcode I update my Minimum Deployments and then do a build, the Package.swift file isn't updated to the latest supported platforms. See: #162072

Repro

  1. Create an app with a plugin:

    flutter create my_app
    cd my_app
    flutter pub add url_launcher
    
  2. Generate the project configuration with SwiftPM on:

    flutter config --enable-swift-package-manager
    flutter build ios --config-only
    
  3. Open the project in Xcode:

    open ios/Runner.xcworkspace
    
  4. In Xcode, open Project Navigator > Package Dependencies > FlutterGeneratedPluginSwiftPackage.

    Check the generated package's supported platforms:

    let package = Package(
        name: "FlutterGeneratedPluginSwiftPackage",
        platforms: [
            .iOS("12.0")
        ],
        ...
    )
  5. In Xcode, open Runner target > General > Minimum Deployments and set iOS to 15.0

  6. In Xcode, build the app

  7. Check the generated package's supported platforms. It will still be .iOS("12.0")

Workaround

To fix this, build the app using the Flutter tool:

flutter build ios --config-only

This regenerates the Package.swift file and updates its supported platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectplatform-iosiOS applications specificallyplatform-macBuilding on or for macOS specificallyteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions