Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SiarheiFedartsou/5bfb381d6f175090b1eb90fe5b9678c4 to your computer and use it in GitHub Desktop.
Save SiarheiFedartsou/5bfb381d6f175090b1eb90fe5b9678c4 to your computer and use it in GitHub Desktop.
protocol Foo1 {
func foo1() -> String
}
protocol Foo2 {
func foo2() -> String
}
extension Foo1 where Self : Foo2 {
func foo1() -> String {
return "foo" + self.foo2()
}
}
struct Foo : Foo1, Foo2 {
func foo2() -> String {
return "test"
}
func test() {
print(self.foo1())
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
print(Foo().test())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment