MixerAPI 1.6.5

MixerAPI 1.6.5

测试已测试
Lang语言 SwiftSwift
许可证 MIT
Released最新发布2017 年 6 月
SwiftSwift 版本3.0
SPM支持 SPM

Jack Cook维护。



 
依赖
Starscream~> 2.0
SwiftyJSON~> 3.1
 

MixerAPI 1.6.5

MixerAPI

这是一个使用Swift编写的Mixer客户端库。

特性

  • 使用Mixer认证并管理您的用户会话
  • 检索有关频道、用户和其他资源的完整数据
  • 通过聊天和交互服务器发送和接收数据包
  • 完整文档

使用方法

要运行示例项目,克隆仓库,然后先从示例目录中运行pod install

要求

  • iOS 8.2+ / tvOS 9.0+(macOS和watchOS即将推出)
  • Xcode 7.3+

使用方法

检索频道数据

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文件。