Question: I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:

```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
    datePicker = datePicker.hidden()
}

```

In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` is a `_ModifiedContent<DatePicker<EmptyView>, _HiddenModifier>`. So I cannot assign `datePicker.hidden()` to `datePicker`. I've tried variations of this and can't seem to find a way that works. Any ideas?

**UPDATE**

You can unwrap the `_ModifiedContent` type to get the underlying type using it's `content` property. However, this doesn't solve the underlying issue. The `content` property appears to just be the original, unmodified date picker.

Answer: 
Here is the simple way to Show/Hide view in SwiftUI.

1. Add `@State` variable:

```
@State var showLogo = false

```
2. Add condition like below:

```
VStack {
    if showLogo {
        Image(systemName: "house.fill")
            .resizable()
            .frame(width: 100, height: 100, alignment: .center)
            .foregroundColor(Color("LightGreyFont"))
            .padding(.bottom, 20)
    }
    Text("Real State App")
        .font(Font.custom("Montserrat-Regular", size: 30))
}.padding(.vertical, 25)

```
3. Change state of your @State variable to Show/Hide the view like below:

```
Button(action: {
    withAnimation{
        self.showLogo.toggle()
    }

}, label: {
    Text("Login").font(.system(size: 20, weight: .medium, design: .default))
        .frame(minWidth: 0, maxWidth: .infinity, maxHeight: 50)
        .foregroundColor(Color("BlackFont"))
        .cornerRadius(10)

})

```

[![enter image description here](https://i.stack.imgur.com/mgUdD.gif)](https://i.stack.imgur.com/mgUdD.gif)
Command-click the view in question and select the Make Conditional option in Beta 5. I did this on one of my views (LiftsCollectionView), and it generated the following:

```
    if suggestedLayout.size.height > 150 {
      LiftsCollectionView()
    } else {
      EmptyView()
    }

```