Skip to content

[SwiftPM Add2App] Add flag to allow Flutter framework to use a remote url instead of copying #81867

Description

@jmagman

Add flutter build ios-framework --swift-package flag to generate a Swift package manifest for the Flutter.xcframework to be consumed by the host app without the Flutter SDK installed, as an alternative to CocoaPods.

Would look something like:

// swift-tools-version:5.3

import PackageDescription

let package = Package(
  name: "Flutter",
  platforms: [
    .iOS(.v9)
  ],
  products: [
    .library(
      name: "Flutter",
      targets: ["Flutter"]),
  ],
  targets: [
    .binaryTarget(
      name: "Flutter",
      url: "https://storage.googleapis.com/flutter_infra_release/flutter/5d8bf811b3072390933d69f3e289a4bb673636c4/ios-release/artifacts.zip",
      checksum: "746f02ffe75c030e98d028be45917da0bd04327eef6207e48e008ea5933861e9"
  ]
)

This requires that the Swift checksum be calculated for the iOS engine artifacts zip containing the XCFramework
https://developer.apple.com/documentation/swift_packages/distributing_binary_frameworks_as_swift_packages#3578966

Note swift package compute-checksum annoyingly requires a Package.swift file in the working directory, even if it's empty.

$ touch Package.swift
$ swift package compute-checksum artifacts.zip
746f02ffe75c030e98d028be45917da0bd04327eef6207e48e008ea5933861e9

This could be calculated as part of downloading the artifacts locally on the developer's machine before the zip is deleted, or it could be done on the engine publishing side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: existing-appsIntegration with existing apps via the add-to-app flowc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Fluttercustomer: castawayplatform-iosiOS applications specificallyt: xcode"xcodebuild" on iOS and general Xcode project managementteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions