UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

labelsHidden() not working

Forums > SwiftUI

Can somebody perhaps confirm that the labelsHidden() does not work on Picker as described in https://www.hackingwithswift.com/quick-start/swiftui/how-to-hide-the-label-of-a-picker-stepper-toggle-and-more-using-labelshidden

(but it does work on Toggle control)

Is this "by design" or is this a bug and I should file Apple a feedback for it?

NavigationView {
    Form {
        Picker("Select a number", selection: $selectedNumber) {
            ForEach(0..<10, id: \.self) {
                Text("\($0)").tag($0)
            }
        }

        Picker("Hidden label", selection: $selectedNumber) {
            ForEach(0..<10, id: \.self) {
                Text("\($0)").tag($0)
            }
        }
        .labelsHidden()
    }
}

3      

Works for me using Xcode 11.7. I haven't upgraded to Xcode 12 yet so can't confirm if it's working there or not.

picker label hidden

3      

Hi

Tried it both 11.7 hides label, and in 12 beta 6 does not hid label

But interesting when using the .pickerStyle(WheelPickerStyle()) it hides the label, when in 11.7 it does not unless you use .labelsHidden() as well

So maybe it change to do that 🤔

Nigel

3      

Thanks, i've filed FB8704602 at https://feedbackassistant.apple.com because I consider this a regression.

Perhaps this bug has sneaked in while they fixed something else. I hope they will fix that, as the current style with a label is sometimes really ugly (depends on the controls above and below the Picker).

3      

I just leaved a blank space to the label area :)

3      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.