Repository navigation
[SwiftPM Add2App] Add flag to allow Flutter framework to use a remote url instead of copying #81867
Description
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.
Activity
[-]Allow add-to-app frameworks to be consumed as Swift Packages[/-][+]Allow add-to-app Flutter.xcframework to be consumed as a Swift Package[/+]vashworth commentedon May 23, 2024
@loic-sharma This is handled in the prototype fyi: master...vashworth:flutter:spm_add_to_app_v1#diff-c6872f55532a514e6052498e0c2377be097680b6cfb7db27882c2dea93e61620R507-R538
[-]Allow add-to-app Flutter.xcframework to be consumed as a Swift Package[/-][+][SwiftPM Add2App] Add flag to allow Flutter framework to use a remote url instead of copying[/+]Inject FlutterFramework dependency in iOS Add2App swift packages (#18…
Inject FlutterFramework dependency in iOS Add2App swift packages (flu…
Inject FlutterFramework dependency in iOS Add2App swift packages (flu…
Inject FlutterFramework dependency in iOS Add2App swift packages (#18…