Skip to content

Commit f0505d7

Browse files
Remove a limitation on @objc protocol adoption.
For example, this works even though the C class isn't marked @objc, isn't a subclass of NSObject, and isn't a subclass of an @objc class: import Foundation @objc protocol P {} class C: P {} Co-authored-by: Slava Pestov <spestov@apple.com>
1 parent b20a23e commit f0505d7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Sources/TSPL/TSPL.docc/LanguageGuide/Protocols.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,9 +2145,8 @@ Optional requirements are available so that you can write code
21452145
that interoperates with Objective-C.
21462146
Both the protocol and the optional requirement
21472147
must be marked with the `@objc` attribute.
2148-
Note that `@objc` protocols can be adopted only by classes
2149-
that inherit from Objective-C classes or other `@objc` classes.
2150-
They can't be adopted by structures or enumerations.
2148+
Note that `@objc` protocols can be adopted only by classes,
2149+
not by structures or enumerations.
21512150

21522151
When you use a method or property in an optional requirement,
21532152
its type automatically becomes an optional.

0 commit comments

Comments
 (0)