This PR contains the work done to update the library and the attached example project to use the Swift 6.4 computer as a minimum supported version and also, to use the latest features introduced in it. Reviewed-on: #1 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
29 lines
879 B
Swift
29 lines
879 B
Swift
internal import CPlaydate
|
|
|
|
extension Scoreboards {
|
|
/// A score on a board. Copied from `PDScore` or `PDListScore`.
|
|
public struct Score {
|
|
/// Position on the board, from 1.
|
|
public let rank: UInt32
|
|
public let value: UInt32
|
|
/// Name of the player who posted it.
|
|
public let player: String
|
|
/// `nil` if the C API gave none.
|
|
public let boardID: String?
|
|
|
|
init(_ score: PDScore) {
|
|
rank = score.rank
|
|
value = score.value
|
|
player = String(playdateCString: score.player) ?? ""
|
|
boardID = String(playdateCString: score.boardID)
|
|
}
|
|
|
|
init(_ score: PDListScore, boardID: String?) {
|
|
rank = score.rank
|
|
value = score.value
|
|
player = String(playdateCString: score.player) ?? ""
|
|
self.boardID = boardID
|
|
}
|
|
}
|
|
}
|