In SwiftUI, if we have a let that is declared inside the View body code such as:
var body: some View {
// ...
let settingsBar = ZStack{
Image(systemName: "gear")
.resizable()
.scaledToFit()
.frame(width:buttonCircleSide/2,height:buttonCircleSide/2)
.foregroundStyle(.white)
}.frame(width: buttonCircleSide, height: buttonCircleSide)
// ...
}
Is that optimized somehow either by the compiler or something else so that this object creation doesn’t actually happen every time the view is refreshed? Or do we need to move it higher in scope? Is it not actually a “real” assignment operation?