Wherever AppStorage is defined, the var is a unique instance as far as that property Wrapper is concerned. The scope is where that is defined.
If you define it in a ViewModel (conforming to ObservableObject) then you can access it wherever you need to assuming that the view model is relevant to that View. In that case you can refactor it and the change in the var name will ripple through all Views accessing that model property.
Be careful though. Generally the way you name your AppStorage property is such that there is synergy between the parameter and the variable name. ie let’s say you define this AppStorage variable:
@AppStorage("username") var username: String = "annonymous"
If you refactor the var - username - then it wont line up with the parameter name it was given -
Essentially what you are saving is a
key:value pair so the key in the example above is “username” (as defined by the parameter in
AppStorage("username") and the value is “anonymous”
If you define
@AppStorage("username") var dogsBreakfast: String = "Pal meaty bites" somewhere else with the same parameter name but a different var name then it still references the same parameter value which is - username - so the two locations will deal with the same object in Storage.
I hope all of that makes sense.