79169866

Date: 2024-11-08 11:43:51
Score: 0.5
Natty:
Report link

In case it helps anyone. The thing that caught me out was trying to put the protocol refererence in my existing Objective-C "ViewController.h" file @interface declaration as I had a lot of other existing protocol and method definitions in the .h file.

@interface ViewController: UITableViewController <AnotherDelegate, CuteDelegate> {....}  ..... @end

But, Objective-C header files can't see the Swift auto generated headers (e.g. "TestObjcUsingGPKit-Swift.h" ) so XCode complained about CuteDelegate being undefined. Finally I found out that you can also add an interface declaration in the .m file as well with just the delegate declarations in if it looks like this:-

@interface () UITableViewController <AnotherDelegate, CuteDelegate>

and still have the .h file declaration looking like this:-

@interface ViewController: UITableViewController
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @interface
  • Low reputation (0.5):
Posted by: goelectric