Cannot use respondsToSelector using ARC on Mac
Solution 1:
Make the protocol conform to NSObject
@protocol MTScrollViewDelegate <NSObject>
Otherwise the compiler doesn't think that the object will respond to NSObject messages like respondsToSelector
, and will generate a warning. It will succeed at runtime without issues either way.
Solution 2:
For Swift this becomes:
@objc protocol MTScrollViewDelegate: NSObjectProtocol
The NSObject protocol groups methods that are fundamental to all Objective-C objects.
For more information on what NSObjectProtocol is: https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/index.html