Suppose I make a UIViewController a UIScrollViewDelegate.
Do I need to implement all methods for the delegate, or can I just implement the 1 I care about?
Suppose I make a UIViewController a UIScrollViewDelegate.
Do I need to implement all methods for the delegate, or can I just implement the 1 I care about?
If you cmd + click
in xcode where you have declared that you implement the protocol
<UIScrollViewDelegate>
Xcode will take you to the header file where the protocol is defined. Here you can see that all of the methods for UIScrollViewDelegate
are declared as @optional
therefore you can just implement the ones you want.
If you prefer the documentation then Apple
marks the required methods with required method
in the Tasks
section.
Additionally the compiler will show warnings if you say you conform to a protocol but do not implement required methods.