Home > AI > IOS > SwiftUI >

layoutPriority(_:)

Sets the priority by which a parent layout should apportion space to this child.

Example :

1
2
3
4
5
6
7
8
9
10
11
12
HStack {
    Text("This is a moderately long string.")
        .font(.largeTitle)
        .border(Color.gray)
 
    Spacer()
 
    Text("This is a higher priority string.")
        .font(.largeTitle)
        .layoutPriority(1)
        .border(Color.gray)
}

Leave a Reply