Jump to content
THIS IS THE TEST SITE OF EUROBRICKS! ×
THIS IS THE TEST SITE OF EUROBRICKS!

Recommended Posts

Posted (edited)

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
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...