Is it possible to have a List with an index on the right hand side, like the example below in SwiftUI?
<
I've made a couple of changes to @Mozahler's and @DirectX's code, refining the result.
I didn't want the main list to include headers with no content, so in the implementation the line under List { becomes:
ForEach(indexes, id: \.self) { letter in
rather than
ForEach(alphabet, id: \.self) { letter in
Setting a background and uniform width for the index column sets it off from any background and unifies the result:
Text(letter)
.frame(width: 16)
.foregroundColor(Constants.color.textColor)
.background(Color.secondary.opacity(0.5))
.font(Constants.font.customFootnoteFont)
.padding(.trailing, 7)