I want some of my classes (not all) to conform using \'Class-Only Protocols\' from docs. What I am doing is
protocol RefreshData: class, ClassA, ClassB
{
fun
The answers provided by Chris and Wain are correct. I'm just adding a few more details here.
You must distinguish the concept of declaring a protocol
(available for classes)
protocol RefreshData: class {
func updateController()
}
...from the concept of conforming your class to a protocol
class ClassA: RefreshData {
func updateController() {
}
}
Sometimes you want to conform a class to a protocol but you don't own the source code for that class. In this case you can use an extension
extension ClassB: RefreshData {
func updateController() {
}
}