readBytes is just Data, so you need to decode the Data into whatever you are expecting it to be.
e.g. if you are expecting a string, try something like:
/// I don't have your readBytes, so I'll make a dummy one...
let readBytes = Data()
/// Convert to the target class you are expecting (e.g. String)
guard let string = String(data: readBytes, encoding: .utf8) else {
print("Error: couldn't get String from readBytes")
return
}
/// Success...
print("string: \(string)")
Does that answer your question?
Topic:
App & System Services
SubTopic:
Networking
Tags: