小编Rya*_*ert的帖子

枚举:"无法构造,因为它没有可访问的初始值设定项"

我无法使用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.
Run Code Online (Sandbox Code Playgroud)

swift

7
推荐指数
1
解决办法
6946
查看次数

标签 统计

swift ×1