Git Product home page Git Product logo

mixer-client-swift's Introduction

MixerAPI

Build Status CocoaPods Compatible

This is a client library for Mixer written in Swift.

Features

  • Authenticate with Mixer and manage your user session
  • Retrieve full data about channels, users, and other resources
  • Send and receive packets through the chat and Interactive servers
  • Complete Documentation

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 8.2+ / tvOS 9.0+ (macOS and watchOS coming soon)
  • Xcode 7.3+

Installation

CocoaPods

You can add MixerAPI to your project by adding it to your Podfile.

Because MixerAPI is written in Swift, you will need to add the use_frameworks! flag in your Podfile.

platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
  pod 'MixerAPI', '~> 1.6'
end

Usage

Retrieving Channel Data

import MixerAPI

MixerClient.sharedClient.channels.getChannelWithId(252) { (channel, error) in
    guard let channel = channel else {
        return
    }

    print("\(channel.token) has \(channel.viewersCurrent) viewers.")
}

Connecting to Chat

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")
    }
}

License

MixerAPI is available under the MIT license. See the LICENSE file for more info.

mixer-client-swift's People

Contributors

jackcook avatar mattjustmatt avatar simonschick avatar yuzha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mixer-client-swift's Issues

Not working with Swift Package Manager

It's currently not possible for me to use the Mixer client as a dependency in my Swift command line tool for Linux.

Upon building, errors like this one appear in large amounts: error: use of undeclared type 'Date'

After some research I believe that CocoaPods is the reason and migrating the project to the new SwiftPM folder structure would solve the problem.

Any comments on this would be highly appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.