Where to Use Protocols

Asked 2 years ago, Updated 2 years ago, 116 views

I would like to ask you a question because I am not sure about the iOS protocol.
First of all, is the protocol used mainly for "delivery"?
Are there few other uses besides delivering?
Can you think of other things like, "You can use polymorphism because you can share functions," or "It makes it easier for others to understand what kind of design the class is when they see their code?"
If you're using protocols to "make it easier for others to understand what a class is designed for when they see their code," wouldn't you use protocols from that perspective in personal development?(Should I use the protocol for personal development to make it easier for me to understand the code a month later?)

I want to learn about the concept of protocol-oriented programming and programming using protocols, but I rarely have the opportunity to use protocols.When should I use the protocol?

ios swift objective-c delegate protocol

2022-09-30 18:45

1 Answers

The Protocol of Objective-C is different from the Protocol of Swift.
In , if you look for information about Swift's Protocol...

Learn Protocol Oriented Programming from WWDC sessions as proposed by Swift2

Use Protocol aggressively with Swift

Use structures, not classes.Protocols and protocol extensions can be equivalent to class inheritance.and so on.
As for Swift2 or later, I have the impression that it is worth sitting down and studying.


2022-09-30 18:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.