From 096c00ec49b837ba5b66ffa23d3d31846e384993 Mon Sep 17 00:00:00 2001 From: DenAlNik Date: Tue, 21 May 2024 02:51:05 +0300 Subject: [PATCH] working changing theme of app --- LiveRecipes/Localizable.xcstrings | 68 ++++++++++++++++ .../Modules/Settings/SettingsView.swift | 77 +++++++++++-------- .../Modules/Settings/SettingsViewModel.swift | 18 +++++ 3 files changed, 133 insertions(+), 30 deletions(-) diff --git a/LiveRecipes/Localizable.xcstrings b/LiveRecipes/Localizable.xcstrings index 974e73c..3c7b193 100644 --- a/LiveRecipes/Localizable.xcstrings +++ b/LiveRecipes/Localizable.xcstrings @@ -868,6 +868,23 @@ } } }, + "dark.theme" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Dark" + } + }, + "ru" : { + "stringUnit" : { + "state" : "translated", + "value" : "Темная" + } + } + } + }, "Delete" : { "localizations" : { "ru" : { @@ -1347,6 +1364,23 @@ } } }, + "light.theme" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Light" + } + }, + "ru" : { + "stringUnit" : { + "state" : "translated", + "value" : "Светлая" + } + } + } + }, "min.filters" : { "extractionState" : "manual", "localizations" : { @@ -2604,6 +2638,23 @@ } } }, + "system.theme" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "System" + } + }, + "ru" : { + "stringUnit" : { + "state" : "translated", + "value" : "Системная" + } + } + } + }, "tab.cooking" : { "extractionState" : "manual", "localizations" : { @@ -2672,6 +2723,23 @@ } } }, + "theme.settings" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Theme" + } + }, + "ru" : { + "stringUnit" : { + "state" : "translated", + "value" : "Тема" + } + } + } + }, "then" : { "extractionState" : "manual", "localizations" : { diff --git a/LiveRecipes/Modules/Settings/SettingsView.swift b/LiveRecipes/Modules/Settings/SettingsView.swift index ee7878a..6c406af 100644 --- a/LiveRecipes/Modules/Settings/SettingsView.swift +++ b/LiveRecipes/Modules/Settings/SettingsView.swift @@ -10,42 +10,59 @@ import SwiftUI struct SettingsView: View { @StateObject var viewState: SettingsViewModel @State private var isShowingCreationView = false - @StateObject var creationViewModel = CreationViewModel(creationModel: CreationModel())//это временная дичь + @StateObject var creationViewModel = CreationViewModel(creationModel: CreationModel()) var body: some View { - List { - Section(header: Text("settings.userSettings".localized)) { - Button(action: { - viewState.clearMyRecipes() - }) - { - Text("settings.clearMyRecipes".localized) - .tint(.black) + List { + Section { + Picker(selection: $viewState.selectedSegment, label: Text("Select a segment")) { + ForEach(0..