Issue #897
During continuous events like dragging or TextField typing, and we have a Picker onscreen with large data set, it will slow down main thread.
One option is to explicitly conform that view to Equatable
struct FontPicker: View, Equatable {
@Binding var fontFamily: String
var body: some View {
Picker("", selection: $fontFamily) {
ForEach(NSFontManager.shared.availableFontFamilies, id: \.self) { family in
Text(family)
.tag(family)
}
}
}
static func == (l: FontPicker, r: FontPicker) -> Bool {
l.fontFamily == r.fontFamily
}
}
Then we need to specify equatable
FontPicker(
fontFamily: $element.text.fontFamily
)
.equatable()