Skip to content

Commit 89865ef

Browse files
authored
Add Swift Package Manager to README (#234)
We have added support for Swift Package Manager so this PR adds a section to the docs explaining how to import PusherSwift using Swift Package Manager.
1 parent 35ed3b9 commit 89865ef

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,38 @@ To integrate PusherSwift into your Xcode project using Carthage, specify it in y
108108
github "pusher/pusher-websocket-swift"
109109
```
110110

111+
### Swift Package Manager
112+
113+
To integrate PusherSwift into your project using [Swift Package Manager](https://swift.org/package-manager/), you can add the library as a dependency in Xcode (11 and above) – see the [docs](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app). The package repository URL is:
114+
115+
```bash
116+
https://github.com/pusher/pusher-websocket-swift.git
117+
```
118+
119+
Alternatively, you can add PusherSwift as a dependency in your `Package.swift` file. For example:
120+
121+
```swift
122+
// swift-tools-version:5.1
123+
import PackageDescription
124+
125+
let package = Package(
126+
name: "YourPackage",
127+
products: [
128+
.library(
129+
name: "YourPackage",
130+
targets: ["YourPackage"]),
131+
],
132+
dependencies: [
133+
.package(url: "https://github.com/pusher/pusher-websocket-swift.git", from: "7.2.0"),
134+
],
135+
targets: [
136+
.target(
137+
name: "YourPackage",
138+
dependencies: ["PusherSwift"]),
139+
]
140+
)
141+
```
142+
111143
## Configuration
112144

113145
There are a number of configuration parameters which can be set for the Pusher client. For Swift usage they are:

0 commit comments

Comments
 (0)