![](/img/trans.png)
[英]'UITabBarDelegate' cannot be constructed because it has no accessible initializers
[英]Enumeration: “cannot be constructed because it has no accessible initializers”
我無法使用rawValue初始化程序初始化枚舉。 有什么想法嗎? 錯誤評論如下:
//: Playground - noun: a place where people can play
// Xcode Version 7.3 (7D175)
import UIKit
enum Theme {
case Default, Dark, Graphical
}
let possibleTheme = Theme(rawValue: 1)
// Error: 'Theme' cannot be constructed because it has no accessible initializers.
enum Theme: Int {
case Default, Dark, Graphical
}
let possibleTheme = Theme(rawValue: 1) // Dark
除非指定其類型,否則枚舉沒有原始值。 可能的原始值類型是String
, Character
和任何數字類型。 文檔
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.