Swift OC class method which calls Swift

Swift class category is introduced inside OC

#import "Demo-Swift.h"

In the Swift, for you to call methods and properties, add @objc

 @objc var remark : String?
 @objc func action () {
        
  }

After the addition, the OC, you can call up these properties and methods. It may also be added directly @objcMembers classes, classes may be all methods which can be invoked in properties can in OC

@objcMembers class HttpModel: NSObject {
    var remark : String?
    func action () {
        
    }
}

Reproduced in: https: //www.jianshu.com/p/d90658e2adad

Guess you like

Origin blog.csdn.net/weixin_33978044/article/details/91163486