I have an app that is working ok, but I'm trying to add some preferences to it so that a SettingsView() can manipulate some of it's settings.
in my main view.swift file, i have a set up like this:
Struct BigView: View {
@State var aVariable: Int = 1
//lots of these
func adjustView(input: anExternalStruct?) {
// this method works fine when called within the scope of BigView somewhere
// it changes a handful of the @State variables and BigView behaves as expected
}
var body: some View {
...
}
}
My question is how do I call the adjustView(input:) method from outside of the struct? it references a lot of the BigView @State variables, as it needs to, but I can't seem to figure out how to make it a public function that can be seen from somewhere else.
I've started the process of moving most of my @State variables out into a seperate userSettings struct, but that comes with it's own confusing and hard to manage
I've also tried moving the adjustView(input:) method out of the BigView struct, but then I can't get it to manipulate any of the @State variables.
any ideas?