import UIKit

 

enum TestEnum: String, CustomStringConvertible, CustomDebugStringConvertible {

    case a = "aaa"

    case b = "bbb"

}

 

extension CustomStringConvertible where Self: RawRepresentable {

    var description: String {

        return "\(rawValue)"

    }

}

 

extension CustomDebugStringConvertible where Self: RawRepresentable {

    var debugDescription: String {

        return "\(rawValue)"

    }

}

 

let str: String = "\(TestEnum.a)"

 

print(str)

全站熱搜

小賢 發表在 痞客邦 留言(0) 人氣()