Answers for "swiftui geometryreader breaks layout"

0

swiftui geometryreader

struct ContentView: View {
    var body: some View {
        GeometryReader { geometry in
            HStack(spacing: 0) {
                Text("Left")
                    .frame(width: geometry.size.width * 0.33, height: 50)
                    .background(Color.yellow)
                Text("Right")
                    .frame(width: geometry.size.width * 0.67, height: 50)
                    .background(Color.orange)
            }
        }
    }
}
Posted by: Guest on February-25-2021

Code answers related to "Swift"

Browse Popular Code Answers by Language