Reputation: 119
I have view controller like in Swift:
class ViewController: UIViewController, DraggableViewDelegate {
(Type viewcontroller does not conform to protocol 'DraggableviewDelegate')
I knew that I have to take protocol methods from delegate class, but it was a in Objective-C like:
#import <UIKit/UIKit.h>
#import "OverlayView.h"
@protocol DraggableViewDelegate <NSObject>
-(void)cardSwipedLeft:(UIView *)card;
-(void)cardSwipedRight:(UIView *)card;
@end
@interface DraggableView : UIView
@property (weak) id <DraggableViewDelegate> delegate;
@property (nonatomic, strong)UIPanGestureRecognizer *panGestureRecognizer;
@property (nonatomic)CGPoint originalPoint;
@property (nonatomic,strong)OverlayView* overlayView;
@property (nonatomic,strong)UILabel* information;
-(void)leftClickAction;
-(void)rightClickAction;
@end
Here the methods are in Objective-C:
-(void)method {}
But in Swift it takes:
func methodName(){}
Upvotes: 2
Views: 1205
Reputation: 119
Writing like a func card... its taking the delagate methods. like
-(void)cardSwipedLeft:(UIView *)card; as
func cardSwipedLeft.....
Thanks Doro and Dharmesh Kheni for solution and best tuitorial
Upvotes: 0
Reputation: 2413
Here is Apple guide for you
And here is great answer how to make bridging header
https://stackoverflow.com/a/24005242/2382237
Upvotes: 1