Skip to content

Instantly share code, notes, and snippets.

@ecnepsnai
Created September 16, 2023 02:08
Show Gist options
  • Save ecnepsnai/994925dea3a72a0e6cdfd4909e494e9d to your computer and use it in GitHub Desktop.
Save ecnepsnai/994925dea3a72a0e6cdfd4909e494e9d to your computer and use it in GitHub Desktop.
SwiftUI Regression
//
// ContentView.swift
// SwiftUITest
//
// Created by Ian Spence on 2023-09-15.
//
import SwiftUI
struct ContentView: View {
private let columns = [GridItem(.adaptive(minimum: 100, maximum: .infinity), spacing: 3)]
var body: some View {
NavigationStack {
ScrollView {
LazyVGrid(columns: columns, spacing: 3) {
ForEach(1...1000, id: \.self) { n in
ListItem(index: n)
}
}
}.navigationTitle("Test")
}
}
}
struct ListItem: View {
let index: Int
@State private var showFullscreenCoverView = false
var body: some View {
VStack {
Image(systemName: "checkmark.circle")
Text("Item \(index)")
}
.frame(minWidth: 100, minHeight: 100)
.padding()
.onTapGesture {
showFullscreenCoverView = true
}
.fullScreenCover(isPresented: $showFullscreenCoverView, content: {
NavigationStack {
VStack {
Text("Item \(index)")
Button(action: {
showFullscreenCoverView = false
}, label: {
Text("Close")
})
}
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment