[英]While am I getting an error while setting up GKMatchmakerViewControllerDelegate in Swift?
[英]Why am I getting 'is not a valid digit in integer literal' error while naming Swift enum case?
我正在嘗試創建一個帶有運行距離的枚舉,但Swift
不允許我以這種格式命名enum
案例5K
。 我收到一條錯誤消息,說'K' is not a valid digit in integer literal
。 這是我的代碼:
標識符和類型屬性/枚舉案例不能以數字開頭。 您需要更改枚舉的命名約定。
enum RaceType: String {
case fiveK = "5K"
case tenK = "10K"
case marathon
}
作為作弊,您可以使用 5 或 𝟏 等表情符號作為起始字母。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.