CocoaChina-editors/Welcome-to-Swift

Please check out the code

Closed this issue · 0 comments

http://numbbbbb.gitbooks.io/-the-swift-programming-language-/chapter2/21_Protocols.html#adding_protocol_conformance_with_an_extension

Look:

通过扩展为上一节中提到的Dice类遵循TextRepresentable协议

extension Dice: TextRepresentable {
cun asText() -> String {
return "A (sides)-sided dice"
}
}