Initialising a formatter object in a View body

I noticed something in the Structure your app for SwiftUI previews video, at 15:56 he says:

"And now we can tell SwiftUI to format the text for this name at exactly the right time. This is as easy as defining a formatter..."

https://developer.apple.com/videos/play/wwdc2020/10149/?time=950

Code Block
var body: some View {
let formatter = PersonNameComponentsFormatter()
formatter.style = .long
Text("\(name, formatter: formatter)")
}


It seems to me that this is not that easy for 2 reasons.
  1. I was under the impression we are not supposed to create reference types like a formatter object in the view body, or anywhere in the View that is not property wrapped. Supposedly it causes a heap allocation and slows down SwiftUI's updates. Maybe Swift has been improved to now allocate reference types on the stack instead of the heap and this is now OK?

  2. Given that PersonNameFormatter is dependent on the locale, surely if the locale is changed then the View body will not be recomputed because the View is not detecting a change.

  3. Is the Text View doing its own observing of the locale changes?

If 1 is ok should the View simply subscribe to the locale changing some how? How would that be done?

Or should we make an ObservableObject for the formatter? It can track the locale did change notification and set a new formatter as a @Published property. Use @StateObject in the View for this object so SwiftUI will know to recompute the body when there is a new formatter after a locale change so the person's name can be re-formatted.

Or is my guess at 3 correct that Text handles the locale change for us?