Skip to content

Commit d4f13de

Browse files
committed
Chop the optional-protocol blogpost
1 parent ba3b8c5 commit d4f13de

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

source/_posts/2016-08-21-optional-protocol-methods-without-@objc.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ What Objective-C protocols are in Swift is very special. There is so much that w
1414
There is also no ability to talk to extensions of these protocols. Either they are concrete extensions, with no way you can talk to a protocol and build things like protocol extensions, which we all love and use in Swift. So they’re very limited altogether.
1515
If you actually are writing Swift code, please don’t use these, they make everyone’s life bad as well as they could not be used, say, in a Linux environment, where you don’t have Objective-C runtime.
1616

17+
<!--more-->
1718
He's right! When you annotate a protocol with `@objc`, LLVM will generate a bunch of extra things: an `isa` pointer, runtime sections like: `__objc_imageinfo`, `__objc_classref`, etc. It seems that it's casting the protocol into a `NSObject`, and maybe it will have a performance penalty. Also `@objc` protocols can not be used with struct and enums, just class types.
1819

1920
The following assembly is for `@objc protocol`:

0 commit comments

Comments
 (0)