I am working on converting my project from Objective-c to Swift, and from the Swift class that I use, I have a protocol that I am trying to get in the Objective-c class. My problem is that delegate not available in the Objective-c class. Here is my quick class:
protocol RateButtonDelegate { func rateButtonPressed(rating: Int) } class RateButtonView: UIView { var delegate: RateButtonDelegate? var divider1: UIView! var divider2: UIView! }
When I look at the file MyProject-Swift.h , I do not see the delegate :
@interface RateButtonViewTest : UIView @property (nonatomic) UIView * divider1; @property (nonatomic) UIView * divider2; @end
and when I try to use rateButtonView.delegate in my Objective-c class, I get a compiler error.
Does anyone know a problem? How to access Swift protocol in Objective-c?
coder source share