Q:

Swift : Enum 'cannot be constructed because it has no accessible initializers'

I get this Error in swift 

'BlockColor' cannot be constructed because it has no accessible
  initializers

import Foundation
import SpriteKit

let NumberOfColors: UInt32 = 6

enum BlockColor: Int, Printable {

case Blue = 0, Orange, Purple, Red, Teal, Yellow

var spriteName: String {
    switch self {
    case .Blue:
        return "blue"
    case .Orange:
        return "orange"
    case .Purple:
        return "purple"
    case .Red:
        return "red"
    case .Teal:
        return "teal"
    case .Yellow:
        return "yellow"
        }
}

var description: String {
    return self.spriteName
}

static func random() -> BlockColor {
    return BlockColor(rawValue:Int(arc4random_uniform(NumberOfColors)))!
}
}

I got an error in this line 
 return BlockColor(rawValue:Int(arc4random_uniform(NumberOfColors)))!

I have review my code many times but I couldn't find where is the error

A:

I got the same error. My mistake was that i didn't mention any return (Int) type for enum method ( enum BlockColor:Int). after initialization of Int return type. Its Works now.

