-
-
Save sturdysturge/dcfe8924a5356f9807e97956775af5d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@Namespace var namespace | |
@State var selectedIndex = -1 | |
let column = GridItem(.adaptive(minimum: 50)) | |
var body: some View { | |
ZStack { | |
ScrollView { | |
LazyVGrid(columns: [column, column]) { | |
ForEach(0...99, id: \.self) { index in | |
if selectedIndex != index { | |
AdaptiveView(namespace: namespace, selectedIndex: $selectedIndex, | |
index: index, isSource: true) | |
} else { | |
Rectangle() | |
} | |
} | |
} | |
} | |
.padding() | |
if selectedIndex != -1 { | |
AdaptiveView(namespace: namespace, selectedIndex: $selectedIndex, | |
index: selectedIndex, isSource: false) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment