I have an app that pulls data from a socket using the Stream class.
Everything appears to work as expected, I am receiving data in the delegate method:
func stream(_ Stream: Stream, handle eventCode: Stream.Event)
The challenge I am having is converting the data into useful information. There is an Android app that does what I am trying to accomplish using a ByteBuffer
.
This ByteBuffer
iterates through the data at intervals of 4 and parses the data into the required data types using methods like getFloat
and getInt
.
Basically I want to loop through the InputStream data and retrieve all the values in the stream. Each value is always 4 bytes in length.
How can I do this using Swift 3?