Layout Priority and Metadata

Hi, I was wondering what these properties are and if you could indicate any use cases for them? I can’t find any info about them anywhere. Cheers :slight_smile:

Hi Peter.

Layout Priority controls the priority for items in a stack as to how they will be given space to expand. A simple example would be an HStack with two Text layers in it. By default, they have equal priority so they will each be given half the space. This could result in one or more of the Text layers truncating depending on their content length. If one of the Text layers was more important, you could give it a higher Layout Priority to ensure it is offered as much space as needed to render its content before giving the remainder to the other Text layer.

This is a concept of SwiftUI which Judo surfaces in our visual build tool. You can learn more about layout priority from Apple’s documentation, or SwiftUI tutorial websites. This article on Hacking With Swift does a good job IMO.

It is one of the more complex concepts in SwiftUI so if you find it confusing you are not alone!

Meta data is used when you have integrated the Judo SDK into your own app. You can attach custom key-value pairs to any layer in Judo and use the data to initiate custom behaviour. For example, you could track an event in your app’s analytics SDK anytime a button is tapped and use the Mata Data fields to include custom properties in the event.

Let me know if these explanations make sense and if you have any follow-up questions!

1 Like

That’s great, makes sense. Cheers!