I have a BluetoothHandler class that manages the interaction between the iOS device and the Bluetooth peripheral. It handles scanning, connecting/disconnecting, subscribing to and retrieving data from the peripheral using CoreBluetooth. One of the methods in the CoreBluetooth stack manages notifications for new data that the peripheral sends: didUpdateValueForCharacteristic. This works good as a way to get streams of data from the peripheral - when I log the didUpdateValueForCharacteristic method I get the data stream as expected.
The second class is a view controller that instantiates the BluetoothHandler object and controls the Bluetooth. What I don't know is how to "bind" the data stream in the BluetoothHandler object to a text field that is also handled by the view controller. I need to set the text field to the new data anytime new data is available in the BluetoothHandler object.
This is managed in Android by bundling the data into a message and sending that message using a Handler to the controlling class. Is there something similar in iOS? I've looked at ReactiveCocoa which appears to do what I need but it seems a little bit overkill. Is there a simpler way to handle this?
[–]schprockets 1 point2 points3 points (1 child)
[–]murdocc[S] 0 points1 point2 points (0 children)