Reputation: 11728
// 1.
TestViewController <TestViewControllerProtocol> *testVC = [TestViewController new];
// 2.
TestViewController *testVC = [TestViewController new];
TestViewController.h
@interface TestViewController : UIViewController <TestViewControllerProtocol>
Upvotes: 0
Views: 72
Reputation: 10054
TestViewController
while only the first one implements the protocol TestViewControllerProtocol
.One possible scenario is that you have a superclass TestViewController
with multiple subclasses where only a couple of them actually implement that protocol. If you have some code that uses two of those subclasses that both implement the protocol you can easily store a reference to them using the second option.
Upvotes: 1