I am having a small Issue with initializing a State with Data from an EnvironmentObject.
@EnvironmentObject var settings: Settings
@State var localAllowReminders: Bool
init() {
self._localAllowReminders = State(initialValue: settings.allowReminders)
}
Obviously, I get the following Error Message: 'self' used before all stored properties are initialized.
Question: How can I initialize a State with Data out of a EnvironmentObject?
Thanks for your help.
@EnvironmentObjectbut rather injectingSettingsproperly and storing it as@ObservedObject.