Slide 21
Slide 21 text
Internalize Protocols
Public protocols prevent Dead Function Elimination against witness methods
public protocol MyProtocol {
func foo()
func bar()
}
struct A: MyProtocol {
func foo() {}
func bar() {}
}
struct B: MyProtocol {
func foo() {}
func bar() {}
}
public protocol MyProtocol {
func foo()
}
protocol InternalMyProtocol {
func bar()
}
struct A: MyProtocol, InternalMyProtocol {
func foo() {}
func bar() {}
}
struct B: MyProtocol, InternalMyProtocol {
func foo() {}
func bar() {}
}