Click here to Skip to main content
15,797,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello I've been trying to get scaling text(sized to fit it's container without trailing) into my views with the following modifiers below is the custom button code, and the image is it's containing view. I've applied the following modifiers to the button, but they seem to have no effect. Any guidance is much appreciated! Thank you for your time <3

Screen Shot 2022 10 21 at 7 42 52 AM — Postimages[^]

What I have tried:

.frame(maxWidth: .infinity)
.padding(.trailing, 20)
.font(.system(size: 25))
.fixedSize(horizontal: false, vertical: true)

struct ParkButton: View {
    @StateObject var config: ParkButtonConfig
    @Binding var isUserParkedHere: Bool
    var roadSide: RoadSide?

    init(operationQueue: OperationQueue, roadSide: RoadSide?, isUserParkedHere: Binding<Bool>) {
        _config = StateObject(
                ParkButtonConfig(operationQueue: operationQueue)


        self.roadSide = roadSide
        self._isUserParkedHere = isUserParkedHere

    var body: some View {
        GeometryReader { g in
            Button {
                config.detailViewDidSelectPark(roadSide: roadSide)
            } label: {
                Text(isUserParkedHere ?
                     LocalizedStrings.parkButtonSelectedTitle :

                    RoundedRectangle(cornerRadius: 5)
                        .stroke(Color.white, lineWidth: 1)
            //.frame(minWidth: g.size.width / 3 , maxWidth: .infinity, alignment: .leading)
Updated 21-Oct-22 3:26am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900