Reachability.swift
Reachability.swift copied to clipboard
How to Add the package within SPM as dependency
I am adding Reachability as a dependency in my Swift package. There is no documentation of how would I do that?
There is this error
unknown package 'Reachability' in dependencies of target 'ABC'
My swift.package manifest code
.package(url: "https://github.com/ashleymills/Reachability.swift.git", from: "5.1.0"),
.product(name: "Reachability", package: "Reachability"),
@ShayanPapershift hi, I've faced with this issue too. Have you solved it?
Was solved:
.package(name: "Reachability", url: "https://github.com/ashleymills/Reachability.swift", .upToNextMajor(from: "5.1.0"))
.product(name: "Reachability", package: "Reachability"),
Just need to be added name: "Reachability"
for dependencies
Yes, I solved it by passing the name of the package :)
you add Package name as said @ShayanPapershift, after use it on your dependencies
exemple:
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.4.0")), .package(name: "Reachability", url: "https://github.com/ashleymills/Reachability.swift", .upToNextMajor(from: "5.1.0"))
after
.target( name: "Common", dependencies: ["Alamofire", "Reachability"]),
it worked for me
.package(url: "https://github.com/ashleymills/Reachability.swift", .upToNextMajor(from: "5.1.0")),
.product(name: "Reachability", package: "Reachability.swift"),