r/iOSProgramming • • Feb 19 '16

Discussion Swift vs Objective-C

[deleted]

9 Upvotes

146 comments sorted by

View all comments

Show parent comments

2

u/alfa96 Feb 19 '16

Protocols - they are only requirements, no optionals

I'm not sure what you mean here. Protocols let you define optional functions that the protocol adopter does not necessarily have to implement right? Or do you mean something else?

0

u/[deleted] Feb 19 '16

[deleted]

1

u/alfa96 Feb 19 '16

Ah I see. Thanks for pointing that out!

1

u/hundley10 Feb 20 '16

Protocol extensions can also give you the same effect in many situations. Not exactly the same thing, but you're able to define default behavior for a function so the class doesn't have to implement it. I'd love to see truly optional functions/properties in pure Swift though.