I have a view that on an iPhone I want to take up the width of the entire screen. Which can easily be done with the code below. But, on an iPad I want the view's width to remain phone-sized vs expand to the edge of the device. Does anybody know how to do that?
struct ContentView: View{
var body: some View{
HStack{
Text("Hello World")
}
.frame(minWidth:0,maxWidth: .infinity)
.background(Color.red)
}
}
EDIT: If anybody else finds this adding this line let me specify a size specifically for the iPad.
.frame(minWidth:0,maxWidth: UIDevice.current.userInterfaceIdiom == .pad ? 500 : .infinity)