My package needs Reachability framework. However, the author doesn't support Swift PM. There is other fork that supports SPM. So I tried that fork. The fork worked in my package. However, when I released my package and tried to use it in my project, the project complained that the Reachability was an unstable-version and could not be built with my project.
I first thought was that the master branch was unstable. So I forked the forked version and labelled it as "3.5" version. However, this time SPM complained that Reachability was still unstable.
What I should do to make it stable?
// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "MyHost", defaultLocalization: "en", platforms: [ .macOS(.v11), .iOS(.v14) ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "MyHost", targets: ["MyHost"]), ], dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), .package(url: "email@example.com:owenzhao/Reachability.git", Package.Dependency.Requirement.branch("3.5")), ], 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: "MyHost", dependencies: ["Reachability"]), .testTarget( name: "MyHostTests", dependencies: ["MyHost", "Reachability"]) ] )
import PackageDescription let package = Package( name: "Reachability", platforms: [ .iOS(.v9), .macOS(.v10_10), .tvOS(.v9), ], products: [ .library( name: "Reachability", targets: ["Reachability"]), ], dependencies: , targets: [ .target( name: "Reachability"), ] )
- create a new macOS app in Xcode
- add MyHost in SPM
The adding always fails, and choose add anyway. Build your app and issue shows.