diff options
| author | Fuwn <[email protected]> | 2026-04-01 13:59:52 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-04-01 13:59:52 +0000 |
| commit | ddaa9cbfe0cc8d254d4901ad192918d91dd627d4 (patch) | |
| tree | b0d1cf6642ae97ce41ff570f2bcd4a06b359685e /Sora/Views/Settings/Section/SettingsSectionProviderView.swift | |
| parent | Fix iOS install recipe app path resolution (diff) | |
| download | sora-testing-ddaa9cbfe0cc8d254d4901ad192918d91dd627d4.tar.xz sora-testing-ddaa9cbfe0cc8d254d4901ad192918d91dd627d4.zip | |
Migrate settings manager to Swift Observation
Diffstat (limited to 'Sora/Views/Settings/Section/SettingsSectionProviderView.swift')
| -rw-r--r-- | Sora/Views/Settings/Section/SettingsSectionProviderView.swift | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Sora/Views/Settings/Section/SettingsSectionProviderView.swift b/Sora/Views/Settings/Section/SettingsSectionProviderView.swift index b9a7900..02a8be6 100644 --- a/Sora/Views/Settings/Section/SettingsSectionProviderView.swift +++ b/Sora/Views/Settings/Section/SettingsSectionProviderView.swift @@ -1,13 +1,16 @@ import SwiftUI struct SettingsSectionProviderView: View { - @EnvironmentObject var settings: SettingsManager + @Environment(SettingsManager.self) + private var settings @State private var showingCustomBooruSheet = false @State private var newDomain: String = "" @State private var newFlavor: BooruProviderFlavor = .danbooru @State private var domainError: String? var body: some View { + @Bindable var settings = settings + Form { Section("Source") { Picker("Website", selection: $settings.preferredBooru) { @@ -173,7 +176,9 @@ struct SettingsSectionProviderView: View { ) { Button("OK", role: .cancel) { () } } message: { - Text(domainError ?? "An unknown error occurred while validating the domain.") + if let domainError { + Text(domainError) + } } } @@ -271,6 +276,6 @@ struct SettingsSectionProviderView: View { #Preview { NavigationStack { SettingsSectionProviderView() - .environmentObject(SettingsManager()) + .environment(SettingsManager()) } } |