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