Home > AI > IOS > SwiftUI >

layoutPriority(_:)

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

Example :

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