Wednesday, November 11, 2026
HomeiOS Developmentios - SwiftUI - scale back further house throughout the record

ios – SwiftUI – scale back further house throughout the record

[ad_1]

I wished some further house on the highest of the record so I attempted utilizing Spacer throughout the record and added modifiers to it. Nevertheless I’m not seeing the peak getting lowered additional. Beneath is the code for my view.

CustomView:

import SwiftUI

struct CustomView: View {
    var physique: some View {
        VStack {
            Listing {
                Spacer()
                    .body(minHeight: 1, idealHeight: 1, maxHeight: 2)
                    .fixedSize().listRowBackground(Coloration.clear)
                
                UserLoginDetailsRowView().padding(.init(prime: 0, main: 5, backside: 5, trailing: 5))
                
                ForEach(1..<2) { _ in
                    VStack(alignment: .main) {
                        Textual content("App model").fixedSize(horizontal: false, vertical: true).font(.headline).foregroundColor(.white)
                        Textual content("1.1.0").fixedSize(horizontal: false, vertical: true).font(.subheadline).foregroundColor(.white)
                        Spacer()
                    }.padding(.backside, 15)
                }.listRowBackground(Coloration.clear)
            }
        }.navigationBarTitle("Foremost Menu")
    }
}

UserLoginDetailsRowView code:

import SwiftUI

struct UserLoginDetailsRowView: View {
    var physique: some View {
        GeometryReader { geometry in
            VStack(alignment: .middle) {
                Spacer()
                Spacer()
                Textual content("Consumer's full title").lineLimit(2).font(.headline)
                Textual content("Username").lineLimit(2).font(.subheadline)
                Spacer()
            }
            
            ZStack {
                Picture("user-gray")
                    .resizable()
                    .aspectRatio(contentMode: .match)
                    .body(width: 30 , peak: 30)
                    .offset(x: geometry.measurement.width / 2.8, y: -geometry.measurement.peak/4)
            }
        }.body(minHeight: 60.0)
    }
}

That is the way it seems with this code:

enter image description here

Whatever the adjustments I make to minHeight, idealHeight and maxHeight in Spacer() inside CustomView the consequence stays the identical. Nevertheless I need half of the house of what it is at the moment displaying. I even tried changing Spacer() with VStack and setting a body peak modifier to it, however at minimal, I do all the time see this a lot of house. I need the house lowered to half.

If I take away the Spacer() from CustomView then the picture on my customized row will get chopped off and appears one thing like this. How do I scale back the house to half of what it’s now?

enter image description here

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments