Using the Objective-C Protocol in Swift

I have a protocol defined in Objective-C as shown below

@protocol TestProtocol @required - (void) printInputString:(NSString*) s @end 

This protocol is sent to the Swift project via pod, and the module name is someModule

I want to use this protocol in Swift projects on

  • Pure Swift Class, i.e. not inherited from NSObject
  • The Swift class, which inherits from NSObject (for example, through a UIViewController)

Example 1

 class TestPureSwiftClass: TestProtocol 

Example 2

 class ArgumentModificationSwift: UIViewController, TestProtocol 

When I implement only for Example 1 , everything works fine, but as soon as I do it, as in Example 2 , it gives me an error Module someModule not found

How to fix it?

+5
source share

Source: https://habr.com/ru/post/1263531/


All Articles