xxxxxxxxxx
import SwiftUI
struct ContentView: View {
var body: some View {
HStack {
Spacer()
// Your view that should occupy half width
Text("Half Width View")
.frame(maxWidth: .infinity)
.background(Color.green)
Spacer()
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}