Files
leaderboards-app-swift/Berry Leaderboards/Player.swift
T
Lncvrt 7828d258e7 1.0.2
made it work for new format
2025-06-22 12:55:08 -07:00

19 lines
355 B
Swift

//
// Player.swift
// BerryLeaderboards
//
// Created by Lncvrt on 6/9/25.
//
import Foundation
struct Player: Codable {
let username: String
let score: Int
}
func parseLeaderboard(_ raw: String) -> [Player] {
guard let data = raw.data(using: .utf8) else { return [] }
return (try? JSONDecoder().decode([Player].self, from: data)) ?? []
}