I have a CustomView and it's frame needs to be 2000w x 2000h. I want to put this view in a VStack along with other Views. The problem is that, obviously, my CustomView is 2000x2000 which of course does not correctly fit on iPhones. I want this view to scale to fit in the VStack. I don't want this view's frame to change but to scale itself to fit in the VStack.
I've tried .scaledToFit() but I have not gotten the correct result by any means. How would I go about doing this? Please excuse any ignorance on my part, I've been learning SwiftUI over the past week or so.
struct MainView: View {
var body: some View {
VStack {
CustomView()
.scaledToFit()
// ...other views
}
}
}
struct CustomView: View {
var body: some View {
ZStack {
// ...content
}
.frame(width: 2000, height: 2000)
}
}