I am trying to make a list with a dictionary. My dictionary is located in a model. My dictionary is [String : String]. I tried to sort it hopefully it is sorted by alphabetical. I couldn't figure it out why it does not work
var fw: Deck
var body: some View {
let sortedDict = fw.dictItems.sorted(by: < )
let keys = sortedDict.map {$0.key}
let values = sortedDict.map {$0.value}
return List{
ForEach(keys.indices) { index in
HStack {
Text(keys[index])
Text("\(values[index])")
}
}
}
}
}