I have the method which has to print the username when the user connected but the error withUnsafeBytes is deprecated: use withUnsafeBytes(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R instead pops up.
method:
func joinChat(username: String) {
let data = "iam:\(username)".data(using: .ascii)!
self.username = username
_ = data.withUnsafeBytes { outputStream.write($0, maxLength: data.count) } //deprecated
}
Somebody know how to solve it?