You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use SwiftSoup to extract XML data for my SwiftUI app. It works perfectly but recently I run up to a problem when working with very large XML files (10000 lines). Even though I use SwiftUI's async and task functionality to parse the data in the background, it still blocks the main thread.
Please see the sample code below to explain the situation.
List {
ForEach(data) { element in
ElementRow(element: element)
}
}
.task {
let (data, _) = try await session.data(from: some url)
let xml = String(data: data, encoding: .utf8)
let document = try SwiftSoup.parse(xml, "", Parser.xmlParser()) // <- This is where the hang comes up from
<...>
self.data = result
}
Any ideas on way forward to avoid the app hanging up while SwiftSoup parses large XML file?
Thanks!
The text was updated successfully, but these errors were encountered:
Dear all,
I use SwiftSoup to extract XML data for my SwiftUI app. It works perfectly but recently I run up to a problem when working with very large XML files (10000 lines). Even though I use SwiftUI's async and task functionality to parse the data in the background, it still blocks the main thread.
Please see the sample code below to explain the situation.
@State var data: [Element] = []
Any ideas on way forward to avoid the app hanging up while SwiftSoup parses large XML file?
Thanks!
The text was updated successfully, but these errors were encountered: