swift
let bounds = UIScreen.main.bounds
bounds.size //画面サイズ
bounds.height//高さ
bounds.width //幅
もう一つの方法
swift
var body: some View {
GeometryReader { geometry in
HStack(spacing: 0) {
Text("Left")
.frame(width: geometry.size.width / 2, height: 50)
.background(Color.green)
Text("Right")
.frame(width: geometry.size.width / 2, height: 50)
.background(Color.blue)
}
}
}