Class-only protocols, class vs AnyObject?

The StackOverflow answer is out of date as of Swift 4. protocol P : class {} and protocol P : AnyObject {} parse identically and there's no semantic difference between them. We should add a warning to deprecate the former at some point.

23 Likes