I have a SwiftUI app with a button that triggers a pop-up view using the .sheet() modifier. However, the pop-up view appears too large and I would like to make it smaller.
I tried wrapping the pop-up view in a VStack and setting a specific frame size using the .frame() modifier, but this did not change the size of the view.
Here is an example of my code:
struct ContentView: View {
@State private var showingSmallView = false
var body: some View {
NavigationView {
VStack {
List {
Text("hi")
Text("hi")
Text("hi")
}
Button(action: { showingSmallView = true }){
Rectangle()
.frame(width: 50, height: 50)
}
}
}
.sheet(isPresented: $showingSmallView){
VStack {
smallView()
}
.frame(width: 200, height: 200)
}
}
}
struct smallView: View {
var body: some View{
Text("hda")
}
}
I would appreciate any help or suggestions on how to make the pop-up view smaller.