Reachability.swift icon indicating copy to clipboard operation
Reachability.swift copied to clipboard

How to Add the package within SPM as dependency

Open ishayan18 opened this issue 4 years ago • 5 comments

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"),

ishayan18 avatar Jan 05 '21 12:01 ishayan18

@ShayanPapershift hi, I've faced with this issue too. Have you solved it?

Artfire avatar Apr 12 '21 13:04 Artfire

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

Artfire avatar Apr 13 '21 06:04 Artfire

Yes, I solved it by passing the name of the package :)

ishayan18 avatar Apr 13 '21 07:04 ishayan18

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"]),

FZehana avatar Sep 01 '21 09:09 FZehana

it worked for me .package(url: "https://github.com/ashleymills/Reachability.swift", .upToNextMajor(from: "5.1.0")),

.product(name: "Reachability", package: "Reachability.swift"),

clubnika avatar Aug 17 '22 14:08 clubnika