SwiftUI Picker Label Not Showing Issue

«  SwiftUI Image Cause System Run out of Memory Issue
Reservoir Sampling  »

When I try to code with Picker, I just realize Picker Label is not showing now.

It only show me the menu, but without showing any Label of it.

My Env:

Xcode: 13.1
Simulator: iPhone 12 Pro Max - iOS 15.0

This should be an known issue on Apple, here is someone’s report: https://developer.apple.com/forums/thread/688518

Temporary Solution

So far, my handling is use HStack to show my label ⬇️

HStack {
    Text("Sort By")
        .foregroundColor(.blue)

    Picker(
        selection: $selectedSortType,
        content: {
            ForEach(sortType, id: \.self) { type in
                Text(type.rawValue)
            }
        },
        label: {
            Text("Sort By")
        }
    )
}

Hope they will fix this soon 😢

Reference

Published on 04 Dec 2021 Find me on Facebook, Twitter!

«  SwiftUI Image Cause System Run out of Memory Issue
Reservoir Sampling  »

Comments

    Join the discussion for this article at here . Our comments is using Github Issues. All of posted comments will display at this page instantly.