简体   繁体   中英

Method in swift extension of an Objective-C class can not be access from .m file

Method in Swift extension of an Objective-C class can not be access from .m file

I have a bridge header:

extension foViewController {

   public func gome()
    {
        print("Hi");           
    }
}

I can't call method like [self gome]; in viewdidload of .m file

To access Swift files in Objective-C classes, we have to add an import.

For example, if the project name is "De", add:

#import "De-Swift.h"

Only then we can access Swift files in Objective-C.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM