I'm trying to align an image to the right size of a list row in Swift/SwiftUI.
List {
Image(systemName: "pencil")
}
I've tried adding several different alignment tags but none seem to work. Any help would be greatly appreciated :)
Put it in a HStack and add a spacer.
List {
HStack {
Spacer()
Image(systemName: "pencil")
}
}
I assume you wanted this (tested with Xcode 12.1 / iOS 14.1):
List {
Image(systemName: "pencil")
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing)
.listRowInsets(EdgeInsets())
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With