测试已测试 | ✓ |
Lang语言 | SwiftSwift |
许可证 | MIT |
Released最新发布 | 2017 年 6 月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✓ |
由Jack Cook维护。
依赖 | |
Starscream | ~> 2.0 |
SwiftyJSON | ~> 3.1 |
这是一个使用Swift编写的Mixer客户端库。
要运行示例项目,克隆仓库,然后先从示例目录中运行pod install
。
import MixerAPI
MixerClient.sharedClient.channels.getChannelWithId(252) { (channel, error) in
guard let channel = channel else {
return
}
print("\(channel.token) has \(channel.viewersCurrent) viewers.")
}
import MixerAPI
class ChatReceiver: NSObject, ChatClientDelegate {
// Connect to the channel with an id of 252
func start() {
let client = ChatClient(delegate: self)
client.joinChannel(252)
}
// Called when a connection is made to the chat server
func chatDidConnect() {
print("connected to chat")
}
// Called when the chat server sent us a packet
func chatReceivedPacket(packet: Packet) {
if let packet = packet as? MessagePacket {
print("message received: \(packet.messageText)")
}
}
// Called when there is a new viewer count available
func updateWithViewers(viewers: Int) {
print("\(viewers) are watching")
}
}
MixerAPI受MIT许可证保护。有关更多信息,请参阅LICENSE文件。