I need call Swift extension method in Objective-C method. But it remind me "No visible @interface for 'XXX' declares the selector 'custom-extension-method'". What should I do for the Swift extension method?
NSData is automatically bridged to Data in Swift, but it does not mean extension for Data is available in NSData.
You may need another extension for NSData, something like:
And you need to know how Swift methods with throws are converted to Objective-C:
You may need another extension for NSData, something like:
Code Block extension NSData { @objc func AES128Encrypt() throws -> Data { return try (self as Data).AES128Encrypt() } }
And you need to know how Swift methods with throws are converted to Objective-C:
Code Block #import "YourModuleName-Swift.h" //... NSError *error = nil; NSData *encryptedData = [resultData AES128EncryptAndReturnError:&error]; //...