import SwiftUI

struct SelectedDetailView<Contained>: View where Contained: MainContentView {

    @Binding
    var selected: Contained.Item?

    init(selected: Binding<Contained.Item?>) {
        self._selected = selected
    }

    var body: some View {
        if let item = selected {
            Contained(item: item)
                .id(item.id)
        } else {
            EmptyView()
        }
    }
}
