Home > AI > IOS > SwiftUI >

line

struct ContentView: View {
    var body: some View {
        //Horizontal Line in VStack
        VStack{
            Color.gray.frame(height:CGFloat(10) / UIScreen.main.scale)
        }
        //Vertical Line in HStack
        HStack{
            Color.gray.frame(width:CGFloat(10) / UIScreen.main.scale)
        }.onAppear{
            print(UIScreen.main.scale)
        }
    }
}

Leave a Reply