Where to implement Swift protocols?
问题 I have two options when implementing protocol conformance in Swift, with the same end result: Implement the protocol within the class - that is, state the conformance at the top of class definition, and put implementation inside the class body, or Implement the protocol in an extension - that is, code up protocol conformance entirely outside the class. Here is an example: public class MyClass : CustomDebugStringConvertible { ... // Something public var debugDescription : String { return