Post

Replies

Boosts

Views

Activity

Reply to How can I call Swift extension method in my Objective-C class?It doesn't work when using @objc.
OK. Thanks for your help. @OOPer In Swift code, there is AESEncrypt method extension for Data in Data+AES.swift class. extension Data {       func AES128Encrypt() throws - Data { ...... } In Objective-C code, I need to call the AESEncrypt method for resultData. But resultData cannot call the AES128Encrypt method. NSData *aesEncryptData = [resultData AES128Encrypt]; When I add @objc in swift extension method, It's showing "@objc can only be used with members of classes, @objc protocols, and concrete extensions of classes".
Topic: Programming Languages SubTopic: Swift Tags:
May ’21