Sunday, January 28, 2024
HomeiOS Developmentios - SwiftUI - Menu label textual content is loading on Picker...

ios – SwiftUI – Menu label textual content is loading on Picker adjustments


I wish to create Menu with Picker because it’s content material. So I’m utilizing this


struct Mannequin {
    var someString = "asdasd"
}

struct ContentView: View {
    
    non-public var arrays: [String] = [
        "asjkldjlasdjlasjldjklasd",
        "asdasd",
        "adfjklasdjlkjasdjl",
        "asjkdjlasjldkjlaskdjlkasdjlkaljksdjlkasd"
    ]
    
    @State var mannequin: Mannequin = .init()
    
    var physique: some View {
        Menu {
            Picker("", choice: $mannequin.someString){
                ForEach(arrays, id: .self) {
                    Textual content($0)
                }
            }
        } label: {
            Textual content(mannequin.someString)
        }
    }
}

Drawback is that when Picker worth adjustments to longer string, Menu label textual content have this animation like loading textual content. Can this be ommited?

I’ve tried to replace label textual content with @State, however unsuccessfully.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments