mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-21 00:22:12 +00:00
fixed main thread issue
This commit is contained in:
parent
e8b3d09172
commit
7cec64fc9a
1 changed files with 3 additions and 1 deletions
|
|
@ -16,7 +16,9 @@ class HistoryManager: ObservableObject {
|
||||||
init() {
|
init() {
|
||||||
NotificationCenter.default.publisher(for: UserDefaults.didChangeNotification)
|
NotificationCenter.default.publisher(for: UserDefaults.didChangeNotification)
|
||||||
.sink { [weak self] _ in
|
.sink { [weak self] _ in
|
||||||
self?.searchHistory = UserDefaults.standard.stringArray(forKey: "SearchHistory") ?? []
|
DispatchQueue.main.async {
|
||||||
|
self?.searchHistory = UserDefaults.standard.stringArray(forKey: "SearchHistory") ?? []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue