ashleymills / Reachability.swift

Replacement for Apple's Reachability re-written in Swift with closures
MIT License
7.94k stars 948 forks source link

How to Add the package within SPM as dependency #372

Open ishayan18 opened 3 years ago

ishayan18 commented 3 years ago

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"),
Artfire commented 3 years ago

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

Artfire commented 3 years ago

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

ishayan18 commented 3 years ago

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

FZehana commented 3 years ago

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

clubnika commented 2 years ago

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

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