File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
FileBrowserClient/FileBrowserClient/Views Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -73,12 +73,22 @@ struct LocalFileContentContainer: View {
7373
7474 private func loadContent( ) {
7575 errorMessage = nil
76+ content = nil
7677
77- do {
78- self . content = try Data ( contentsOf: localFile)
79- } catch {
80- Log . warn ( " ❌ Error loading file: \( error) " )
81- errorMessage = error. localizedDescription
78+ // DispatchQueue.main.async - Main thread where all UI updates happen
79+ // DispatchQueue.global(qos:) - Background thread used for non-UI tasks
80+ DispatchQueue . global ( qos: . userInitiated) . async {
81+ do {
82+ let data = try Data ( contentsOf: localFile)
83+ DispatchQueue . main. async {
84+ self . content = data
85+ }
86+ } catch {
87+ Log . warn ( " ❌ Error loading file: \( error) " )
88+ DispatchQueue . main. async {
89+ errorMessage = error. localizedDescription
90+ }
91+ }
8292 }
8393 }
8494}
You can’t perform that action at this time.
0 commit comments