Hi I would like to display the top three player’s score but the following codes does not work even though the first element can be accessed. That would be great if you could help. Thanks.
struct ContentView: View {
@Query(sort: \PlayerItem.playerScore, order: .reverse) var playerItems: [PlayerItem]
}
var body: some View {
// this works
Text("Your best score : \(playerItems.first?.playerScore ?? 0)")
// this does not works
Text("Your second best score: \(playerItems.second?.playerScore ?? 0)")
// this also does not works
Text("Your second best score: \(playerItems.second?.playerScore )")
// this also does not works
Text("Your second best score: \(playerItems[1].playerScore )")




