Returns the player’s score as a localized string.
SDKs
- iOS 4.0+
- macOS 10.8+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
Framework
- Game
Kit
Declaration
var formattedValue: String? { get }
Discussion
This property is invalid on a newly initialized score object. On a score returned from GameKit, it contains a formatted string based on the player’s score. You determine how a score is formatted when you define the leaderboard in App Store Connect.
Never convert the value
property into a string directly; always use this method to receive the formatted string.
Important
You may be tempted to write your own formatting code rather than using the formatted
property. Do not do this. Using the built-in support makes it easy to localize the score value into other languages, and provides a string that is consistent with the presentation of your scores in the Game Center app.