title: How to implement two-way binding with additional checks
body: <p>There is a <code>UISwitch</code> and a <code>ControlProperty&lt;Bool&gt;</code> which are bound each other. However I cannot use standard two-way binding operator <code>&lt;-&gt;</code> because of the following requirements:</p>
  <p>If user turns <code>UISwitch</code> ON, I need to check some condition and, if not met, show an alert and revert <code>UISwitch</code> back to OFF state. <code>ControlProperty</code> must remain intact.
  If condition met, <code>ControlProperty</code> becomes <code>true</code>.</p>
  <p>If user turns <code>UISwitch</code> OFF, <code>ControlProperty</code> becomes <code>false</code>.</p>
  <p>If <code>ControlProperty</code> has been (externally) changed, <code>UISwitch</code> must reflect its state unconditionally (as normal binding works). The condition must not be checked.</p>
  <p>I tried the following (maybe naive) approach:</p>
  <pre><code>property.bind(to: cell.switch.rx.isOn).disposed(by: cell.disposeBag)
  
  cell.switch.rx.isOn.bind { [unowned self] isOn in
      if !isOn || viewModel.allowTurnEmailNotificationOn {
          property.onNext(isOn)
      } else {
          let alert = MyAlertViewController()
          present(alert, animated: true) { [weak cell] in
              // revert switch back to OFF state
              cell?.switch.isOn = false
          }
      }
  }.disposed(by: cell.disposeBag)
  </code></pre>
  <p>Generally, it works, but there is a bug: when <code>ControlProperty</code> changes to TRUE due to some external event, it sets <code>UISwitch</code> ON, which in turn launches checking <code>if !isOn || viewModel.allowTurnEmailNotificationOn</code>. As a result, the alert appears.
  I only want to perform this check if user manually turns <code>UISwitch</code> ON.</p>