SwiftRedunda 是一个用于 ping Redunda 的库。
使用 Swift Package Manager
在你的 Package.swift
文件的 dependencies
部分,添加以下 package:
.package(url: "https://github.com/SOBotics/SwiftRedunda.git", from: "0.1.0")
在 targets
中的 .target
的 dependencies
数组中,添加 "SwiftRedunda"
。
安装完成!
在你的 Swift 文件顶部,导入模块
import SwiftRedunda
然后使用 RedundaPingService
来 ping 服务器。
let pingService = RedundaPingService(key: "YOUR_KEY_HERE", version: "1.0") // remember to generate a key at redunda.sobotics.org first!
pingService.startPinging()
在发送聊天消息之前,记住先检查你是否应该处于待机模式!
if !pingService.shouldStandby {
// post messages
}
你应该使用一个遵循 RedundaPingServiceDelegate
协议的类来接收错误。 使用以下方式设置 RedundaPingService
的代理:
pingService.delegate = PingServiceDelegate
其中 PingServiceDelegate
遵循 RedundaPingServiceDelegate
协议。
你可以通过 pingService.debug = true
将服务设置为调试模式。 如果该值为 true,则不会 ping Redunda。
在本仓库的 issues 部分报告 Bug。
你可以在 SOBotics 聊天室中通过 @paper ping 我来联系我。