Say we have a Swift protocol:
protocol SomeProtocol: class { static var someString: String { get } }
Is there a way to access someString from an extension instance method, for example?
extension SomeProtocol { public func doSomething() -> String { return "I'm a \(someString)" } }
I get a compiler error:
The static member "someString" cannot be used in an instance of type "Self"
Is there any way to do this?
source share