Sunday, June 2, 2024
HomeiOS Developmentios - How are let assignments inside view physique dealt with in...

ios – How are let assignments inside view physique dealt with in SwiftUI?


In SwiftUI, if now we have a let that’s declared contained in the View physique code comparable to:

var physique: some View {

    // ...

    let settingsBar = ZStack{
                        Picture(systemName: "gear")
                            .resizable()
                            .scaledToFit()
                            .body(width:buttonCircleSide/2,top:buttonCircleSide/2)
                            .foregroundStyle(.white)
                    }.body(width: buttonCircleSide, top: buttonCircleSide)

    // ...

}

Is that optimized someway both by the compiler or one thing else in order that this object creation would not truly occur each time the view is refreshed? Or do we have to transfer it larger in scope? Is it not truly a “actual” project operation?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments