We usually use the class
keyword to define a class only protocol
in the normal way.
1 | protocol DetailViewControllerDelegate: class { |
Since Swift 4, we have an other way to define it. Introduced in 0156-subclass-existentials
This proposal merges the concepts of class and AnyObject, which now have the same meaning: they represent an existential for classes.
So, it much clearer with the new way:
1 | protocol DetailViewControllerDelegate: AnyObject { |
Happy coding!