Recommended Posts

Since SBrick are taking their sweet time releasing a Swift library/framework, I thought I'd just write one by myself.

It's an early version that supports just the basic commands - driving and stopping (with channel, power, direction), but I'll update it whenever I can.

You can download the framework and a working example from my GitHub: https://github.com/BarakRL/SBrick-iOS

 

 

Usage is pretty straight forward:

var manager = SBrickManager(delegate: self)
manager.startDiscovery()

func sbrickManager(_ sbrickManager: SBrickManager, didDiscover sbrick: SBrick) {
    //connect
    sbrick.delegate = self
    sbrickManager.connect(to: sbrick)
}

func sbrickReady(_ sbrick: SBrick) {
    //send a command
    sbrick.send(command: .drive(channelId: 0, cw: true, power: 0xFF))
}

 

Edited by BarakRL

Share this post


Link to post
Share on other sites

Hey,

Welcome to EB.

That is really nice. Being a developer myself, I have worked with Swift and I really like it. This seems useful.

Share this post


Link to post
Share on other sites

I'm sorry, but I don't quite understand what this does or accomplishes. Or is this more for SBrick Plus?

Edited by Saberwing40k

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.