My ColorPicker looks fine on iPad/iPhone, with colored circles, but on macOS, the color is a rectangle that almost fills the screen width, but isn't even consistent. Using Xcode 12.4, Swift 5, mac catalyst, iOS target is 14.0. Here is the image:
and the code is just standard SwiftUI like this:
Section(header: Text("Region")) {
ColorPicker("Active region color", selection: Binding(
get: { activeColor },
set: { newValue in
activeColorName = newValue.toString
activeColor = newValue
}))
}
Any way to make this look as pretty as the ColorPicker appearance on iOS devices? At least eliminate the ragged left margin? Almost makes me miss AutoLayout.
EDIT:
I ended up doing something like this:
Section(header: Text("Region")) {
HStack {
Text("Active region color")
Spacer()
ColorPicker("", selection: Binding(
get: { activeColor },
set: { newValue in
activeColorName = newValue.toString
activeColor = newValue
}))
.frame(maxWidth: 500)
}
}
But I am surprised that this is necessary, and certainly this isn't as pretty as what you see running on an iDevice.