1

I'm trying a lot of different ways, using padding(), spacer(), frame() modifiers but can't get what I want.

Essentially, I would like for the Stack to have a uniform Look w/ the same font sizes across all labels/values. As can see from the pic, the distance label/value ends up being smaller. (Where should I place the minScaleFactor() for it to effect the entire HStack?)

My Goal is

  1. Have all the values/labels shown in it's entirety
  2. Adjust the spacing between each HStack to be the same
  3. Have MinScaleFactor() apply to all the values/labels so that they appear uniform.

Unfortunately, I'm just not getting it. :-(

enter image description here

  var body: some View {
    HStack (spacing: 15) {
        VStack(alignment: .leading){
          Text("Load")
          Text("24533")
        }
        .padding(.leading, 10)
       VStack(alignment: .leading) {
          Text("Time")
          Text("99h 44m 05s")
        }
        VStack(alignment: .leading) {
          Text("Dist")
          Text("999999.00km")
        }
        VStack(alignment: .leading) {
          Text("D+")
          Text("100000m")
        }
        VStack(alignment: .leading) {
          Text("Calories")
          Text("1000000033333")
        }
        VStack(alignment: .leading) {
          Text("Joules")
          Text("111111")
        }
      }
      .frame(maxWidth: .infinity, alignment: .leading)
      .minimumScaleFactor(0.2)
      .lineLimit(1)
      .font(.subheadline)
      .border(Color.blue, width: 3)
    }

With the suggestion to add a Spacer in between the 2 texts

enter image description here

app4g
  • 670
  • 4
  • 24
  • It is not clear for me what do you want to achieve... What's wrong with minScaleFactor? It works as expected, because you divided space by equal frames but only one Text did not fit into it, so its font decreased. Elaborate more... – Asperi Jul 15 '22 at 17:29
  • for the 1 that did not fit, I would like to have ALL the rest to also be scaled down to the same font size as well. (To look the same) – app4g Jul 15 '22 at 17:32
  • Well, minimumScaleFactor does not work that way... to achieve that you have to calculate everything manually. – Asperi Jul 15 '22 at 17:39
  • One thing would be to add a spacer() between the 2 text so top texts be aligned – Ptit Xav Jul 16 '22 at 07:22
  • @PtitXav tried your suggestion. No Go. – app4g Jul 16 '22 at 14:03

0 Answers0