Open onmyway133 opened 1 year ago
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
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
equatable
FontPicker( fontFamily: $element.text.fontFamily ) .equatable()
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
Then we need to specify
equatable