How to Trigger an Action When a SwiftUI Toggle Changes
Sometimes we may need to call an action every time a toggle changes instead of relying purely on a state property to keep our toggle up to date. Luckily this is easy to do. An action can be called when a toggle is updated (or any control that takes in a binding, such as a slider) and a state property will be used to display the state in the control....