enum SectionType: String, CaseIterable {
case top = \"Top\"
case best = \"Best\"
}
struct ContentView : View {
@State private var selection: Int = 0
Here is another option if you have a component that updates a @Binding. Rather than doing this:
Component(selectedValue: self.$item, ...)
you can do this and have a little greater control:
Component(selectedValue: Binding(
get: { self.item },
set: { (newValue) in
self.item = newValue
// now do whatever you need to do once this has changed
}), ... )
This way you get the benefits of the binding along with the detection of when the Component has changed the value.