Importing an objc control into swift: Error on the one hand (func) of my contole

2

I decided to make an app in swift this time, and as usual I use my custom control (MenuView). In the objC I know how it works and everything worked, in swift I followed all the steps, import in the bridging-header.h, and put the MenuViewDelegate that I created too.

So good, no mistake WhenIputthecommandIcreatedinthecontrol

funcMenuView(MenuView:MenuView!,didTouchsender:UIPanGestureRecognizer!){}

appearedthefollowingerror:(Useofundeclaredtype'MenuView')pointingallthelinesthatcontainedtheobjectofthe"Menuview"

How do I proceed to fix this ?? I did something wrong, I forgot something ... Thanks in advance for your help.

    
asked by anonymous 28.10.2014 / 00:18

1 answer

4

There is a conflict between the name of the MenuView class and the signature of the delegate method that also calls MenuView . In Objective-C, the method signature is MenuView:didTouch , but in Swift it is only MenuView and gesture sender does not appear in the name.

In this case, so that there is no conflict, following the Cocoa design pattern the method name should be - (void)menuView:(MenuView *)menuView didTouch:(UIPanGestureRecognizer *)sender;

    
28.10.2014 / 12:01