title: Interlinked Multiple Sliders in SwiftUI
body: <p>I was wondering whether anyone could help me.</p>
  
  <p>In the app I'm working on, I need to split a value into four different areas and I'd like to do so via four sliders, which control the percentage for each of the areas.</p>
  
  <p>For each <code>Slider</code>, I've created an <code>@State private var sliderAValue = 25</code> and bound them to the sliders via <code>Slider(value: $sliderAValue, in: 0...100)</code></p>
  
  <p>Clearly, when I change the value of any of the sliders, the other values should also change in order that the total percentage is always 100.</p>
  
  <p>But more importantly, the ratio between the other three values should state the same: eg. if the original split is 30 : 30 : 20 : 20 and the user changes the third element to 40%, then the new split should become 22.5 : 22.5 : 40 : 15.</p>
  
  <p>Applying a <code>didSet</code> or a <code>willSet</code> on the <code>State</code> variables doesn't seem to have any effect, yet I clearly need to store the original ratios somewhere and have them automatically updated.  </p>
  
  <p>Any ideas?</p>