I'm using CocoaAsyncSocket pod to transfer data from measurement instrument to an iOS device. The transfer works pretty well, but I get in trouble, if I have to switch between different mobile instruments.
If I need to change the instrument / connect to another instrument, I have to wait for some events:
- I have to be sure to be disconnected. This is typically done by waiting for
public func socketDidDisconnect(...)
included in theGCDAsyncSocketDelegate
- I have to connect to the other instrument. If it is still the tcp interface, I have to wait for
public func socketDidConnectToHost(...)
So there are two operations which take some time. Because there is no valid connection, the user just can wait. To inform the user what's going on, I would like to present an UIAlert until the mentioned events are finished. How can I achieve this?