Код: Выделить всё
Text("LED")
.foregroundColor(Bar_Led_colore )
.font(.system(size: 14))
< /code>
Если я его изменю, я получаю невозможно найти в области < /p>
попытаться использовать < /p>
class AppSettings: ObservableObject {
@Published var appStatus: String = "Normal" // Example status
@Published var currentColor: Color = .purple // The color to change
}
struct ContentView: View {
@StateObject private var settings = AppSettings()
// Creates and owns the instance
( changed to `.foregroundColor(settings.currentColor` )
< /code>
и используемый настройки. Это создаст новый экземпляр каждый раз.
и он не работает:
Я добавил @stateobject var settings = appsettings () asame..br/> Можно все изменить мне цвет.>
Подробнее здесь: https://stackoverflow.com/questions/796 ... de-of-view