jkmassel/ACNKit

Not able to make constant as a DMXUniverse

Closed this issue · 6 comments

Trying to use the example in the README and I receive an error DMXUniverse cannot be constructed because it has no accessible initializers

Things I've done:

  1. Added a Swift Package Dependency pointing to the GitHub repo
  2. created a class SACNHelper
  3. Added a function with the following:
let universe = DMXUniverse(number: 1)

universe.listener = { universe in
  
  let channel1Value = universe.valueForChannel(1)

  debugPrint(channel1Value.percent) // Get the value of a channel as a percent.
  debugPrint(channel1Value.absoluteValue) // A UInt8 with the value between 0 and 255.
}

universe.startListeningForChanges()

I'm going to keep diving a bit more in the source code and see if I missed something.

Further inspection. I couldn't find anything in source for startListeningForChanges

@maeganwilson did you find a solution for this? Having the same issue

I did not. I put a pause on this project for now.

@jkmassel Can you shed some light?

This is because this line should be public and not internal.

Also, the README is incorrect, it should be:

let universe = DMXReceivingUniverse(number: 1)
universe.listener = { universe in
  print(universe[0].absoluteValue, universe[0].percent)
}
universe.connect()

But as the library doesn't seem to be maintained anymore, I now get crashes (EXC_BREAKPOINT) running it on iOS 15.4.

Maybe the best thing would be to start from scratch using the C-based ETC library.

I haven't even looked at this since then... I am unfortunately not one that's smart enough to make this work, but I'm sure someone can make a fresh sACNKit.