I'm using custom scrollview with UIViewControllerRepresentable and works fine But when I using with LazyVStack it doesn't work that I expected.
LazyVStack doesn't create items until it needs to render them onscreen But when I use this with custom scrollview, it draws at once.
So when I do this,
	 ScrollView {
								LazyVStack {
										ForEach(0...10000, id:\.self) {
												Text(String($0))
										}
								}
	 }
It works well as I expected But when I do this
CustomScrollView {
								LazyVStack {
										ForEach(0...10000, id:\.self) {
												Text(String($0))
										}
								}
	}
It comsumes memory as I expected.
Can't I using this with custom scrollView?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
In my app I connected my app via TCP socket (global queue with serial) and get the data from the server and send it to the webView via wkWebview.evaluateJavascript in RunLoop.main
Socket
func socket(_ sock: GCDAsyncSocket, didRead data: Data, withTag tag: Int) {
delegate?.onReceive(encodedData: data)
self.socket?.readData(withTimeout: -1, tag: 0)
}
Subject (Combine) for receiving from the socket
self.onReceivedSubject
.receive(on: RunLoop.main)
.sink { (_) in
} receiveValue: { [weak self] (info) in
self?.callJavascriptFunc(function: WebConstants.JSFunction.socketDataReceived,
param: "'\(info)'")
}.store(in: &disposables)
Call evaluateJavascript
private func callJavascriptFunc(function: String, param: String) {
let functionWithParams = WebConstants.JSFunction.javascript + "\(function)(\(param));"
webView?.evaluateJavaScript(functionWithParams, completionHandler: { (result, error) in
// Do nothing..
})
}
The data from socket is little bit huge and called evaluateJavaScript a hundred in minutes.
Everything works fine but after few seconds, I got below errors and my app's UI is whole blocked.
IConnection::dispatchIncomingMessages: IPC throttling was triggered (has 689 pending incoming messages, will only process 600 before yielding)
How could I fixed this and what's the problem?
Thanks.