I connect like this:
var request: URLRequest = URLRequest(url: url)
request.addValue("websocket", forHTTPHeaderField: "Upgrade")
request.addValue("sip", forHTTPHeaderField: "Sec-WebSocket-Protocol")
request.addValue("permessage-deflate; client_max_window_bits", forHTTPHeaderField: "Sec-WebSocket-Extensions")
request.addValue("13", forHTTPHeaderField: "Sec-WebSocket-Version")
request.addValue(key, forHTTPHeaderField: "Sec-WebSocket-Key")
request.httpMethod = "GET"
socketTask = session?.webSocketTask(with: request)
socketTask?.resume()
And I send the REGISTER message after connection established and this delegate method fires:
func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didOpenWithProtocol protocol: String?) {}
Post
Replies
Boosts
Views
Activity
I can get to the code blocks if I do this:
var aString: AttributedString = try? AttributedString(markdown: m)
for r in aString.runs {
if let pi = r.presentationIntent {
for i in pi.components {
}
}
}
But - then I lose all the new line characters in my initial string.
So I can preserve the new line characters like this:
var aString: AttributedString = try? AttributedString(markdown: m, options: AttributedString.MarkdownParsingOptions(interpretedSyntax: .inlineOnlyPreservingWhitespace))
But - now there are no code block annotations.
Is there a way that I can preserve new lines AND get code block annotations? I need the code block annotations so I can set my own formatting. (At least until Apple renders code blocks properly).
Submitted to feedback assistant - #FB9935141
I see the same behavior in iOS 16, do we have an update to this?
Same problem for me. @Apple - help please
UITextView, and it's as almost as wide as the screen