thisIsTheFoxe
thisIsTheFoxe

Reputation: 1713

Custom list accessory

I want to make a custom list accessory view in SwiftUI.

My idea:

List {
    Button(action: {}, label: {
        HStack {
            Text("CutomView")
            Spacer()
            Circle().frame(alignment: .trailing)
        }
    })
            
    Button(action: {}, label: {
        HStack {
            Text("SF Symbol")
            Spacer()
            Image(systemName: "circle").imageScale(.large)
        }
    })
}

Resulting in: SwiftUI screenshot

It kinda does work with

Circle().frame(width: 25, height: 25, alignment: .trailing)

but that feels really bad to me... Any idea what I'm doing wrong? Any help/resources also about aligning the text properly is appreciated ^.^

What I know is that the Spacer in the first row seems not to 'work' and causing the Circle to use up all the space in the row.

Upvotes: 1

Views: 43

Answers (0)

Related Questions