Skip to content

Commit

Permalink
Added try?
Browse files Browse the repository at this point in the history
  • Loading branch information
samiyr authored Jul 9, 2020
1 parent 1350fc3 commit 8385ee9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ This project is based on SwiftPing: https://github.com/ankitthakur/SwiftPing.
```swift

// Ping indefinitely
let pinger = SwiftyPing(host: "1.1.1.1", configuration: PingConfiguration(interval: 0.5, with: 5), queue: DispatchQueue.global())
let pinger = try? SwiftyPing(host: "1.1.1.1", configuration: PingConfiguration(interval: 0.5, with: 5), queue: DispatchQueue.global())
pinger?.observer = { (response) in
let duration = response.duration
print(duration)
}
pinger?.startPinging()

// Ping once
let once = SwiftyPing(host: "1.1.1.1", configuration: PingConfiguration(interval: 0.5, with: 5), queue: DispatchQueue.global())
let once = try? SwiftyPing(host: "1.1.1.1", configuration: PingConfiguration(interval: 0.5, with: 5), queue: DispatchQueue.global())
once?.observer = { (response) in
let duration = response.duration
print(duration)
Expand Down

0 comments on commit 8385ee9

Please sign in to comment.