Reputation: 817
I am working on a package that makes working with the Unsplash API simple. Here it is.
My problem is that when I add it to my test project, it can't find the package in scope however it can find my other package just fine. I don't see this won't work (I can provide a throwaway api key if you want to test the UnsplashRandom module but right now the fact the package won't import is the problem)
import SwiftUI
import UnsplashSwiftUI
struct UnsplashRandomTest: View {
var body: some View {
UnsplashRandom(clientId: "")
}
}
struct UnsplashRandomTest_Previews: PreviewProvider {
static var previews: some View {
UnsplashRandomTest()
}
}
Upvotes: 2
Views: 832
Reputation: 8347
Your package does not pass the build due to availability errors:
You need to specify the minimum deployment target for the iOS platform. (which I suppose you are interested in)
Since you are using API that is only available in iOS 14 or newer, you can add the platforms
parameter to Package
initializer in your manifest file like so:
let package = Package(
name: "UnsplashSwiftUI",
platforms: [.iOS(.v14)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "UnsplashSwiftUI",
targets: ["UnsplashSwiftUI"]),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "UnsplashSwiftUI",
dependencies: []),
]
)
That fixed your issue.
Upvotes: 1