title: Dynamically hiding view in SwiftUI
body: <p>I'm trying to conditionally hide a <code>DatePicker</code> in SwiftUI. However, I'm having any issue with mismatched types:</p>
  
  <pre><code>var datePicker = DatePicker($datePickerDate)
  if self.showDatePicker {
      datePicker = datePicker.hidden()
  }
  </code></pre>
  
  <p>In this case, <code>datePicker</code> is a <code>DatePicker&lt;EmptyView&gt;</code> type but <code>datePicker.hidden()</code> is a <code>_ModifiedContent&lt;DatePicker&lt;EmptyView&gt;, _HiddenModifier&gt;</code>. So I cannot assign <code>datePicker.hidden()</code> to <code>datePicker</code>. I've tried variations of this and can't seem to find a way that works. Any ideas?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>You can unwrap the <code>_ModifiedContent</code> type to get the underlying type using it's <code>content</code> property. However, this doesn't solve the underlying issue. The <code>content</code> property appears to just be the original, unmodified date picker.</p>