Color picker not working

HStack{
                    FormLable(text: NSLocalizedString("Color", comment: ""))
                    Spacer()
                    Image(systemName: "circle.fill")
                        .font(.system(size: AppFontSize.baseSize.size() * 1.2, weight: .medium))
                        .foregroundColor(color)
                        .overlay(ColorPicker("Color", selection: $color).labelsHidden().opacity(0.015))
                }

This is how I use the color picker. I used the same code in two different apps, and the color picker appeared in one app but not in the other. By the way, I upgraded Xcode to the latest version.

Answered by Claude31 in 825156022

What is FormLable ?

Problem is opacity. You do not see the picker. But if you tap just outside the blue dot, it works (tested with Xcode 16.2).

I changed to:

          Image(systemName: "circle.fill")
              .font(.system(size: 12, weight: .medium))
              .foregroundColor(.blue)
              .overlay(ColorPicker("Color", selection: $color).labelsHidden().opacity(0.5)) // opacity(0.015))

Then you can see the picker more clearly.

After updating xcode to Version 16.2 (16C5032a), the color picker is no longer working. The application that was originally working is also no longer working after being compiled by xcode.

Accepted Answer

What is FormLable ?

Problem is opacity. You do not see the picker. But if you tap just outside the blue dot, it works (tested with Xcode 16.2).

I changed to:

          Image(systemName: "circle.fill")
              .font(.system(size: 12, weight: .medium))
              .foregroundColor(.blue)
              .overlay(ColorPicker("Color", selection: $color).labelsHidden().opacity(0.5)) // opacity(0.015))

Then you can see the picker more clearly.

Color picker not working
 
 
Q