I had some code in my app to handle uploads to AWS that I wanted to extract to it's own package.
This code has a dependency to the AWS iOS Swift SDK at GitHub - aws-amplify/aws-sdk-ios-spm: This repository enables Swift Package Manager support for the AWS Mobile SDK for iOS
In my app, the AWS package works just fine, but once I packaged all my code, and tried to add the AWS package as a dependency, I could not make it work, the dependency package would download, but there seemed no way to add it to any target. I would get errors similar to
"product AWSiOSSDKV2
required by package aws-sdk-test-package
target aws-sdk-test-target
not found"
I tried various different targets, products strings etc from what I could find in the AWS package file, but nothing would work
It can be recreated with any simple package structure, here is my swift.package file
// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "aws-sdk-test-package",
platforms: [
.iOS(.v15)
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "aws-sdk-test-package",
targets: ["aws-sdk-test-package"]),
],
dependencies: [
.package(url: "https://github.com/aws-amplify/aws-sdk-ios-spm.git", from: .init(2, 34, 0))
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "aws-sdk-test-package",
dependencies: [
// Things that didn't work
"AWSiOSSDKV2",
// "aws-sdk-ios-spm",
// "AWSCore",
// .product(name: "AWSCore"),
// .target(name: "AWSCore")
]
),
.testTarget(
name: "aws-sdk-test-packageTests",
dependencies: ["aws-sdk-test-package"]),
]
)
The AWS package does some code to create it's targets and products, I suspect it is the issue, is there a way it will work?